How do I identify which is static and which is non static method?

I have a question which is how can i justify which is static and which is non static method in a program? I need to explain why ? I think it the version 2 which is static. I can only said that it using using a reference. But am I correct or ?? Please advise....
if I have the following :
class Square
private double side;
public Square(double side)
{ this.side = side;
public double findAreaVersion1()
{ return side * side;
public double findAreaVersion2(Square sq)
{ return sq.side * sq.side;
public void setSide(double s)
{ side = s;
public double getSide()
{ return side;
} //class Square
Message was edited by:
SummerCool

I have a question which is how can i justify which is
static and which is non static method in a program? I
need to explain why ? I think it the version 2 which
is static. I can only said that it using using a
reference. But am I correct or ?? Please advise....If I am reading this correctly, that you think that your version 2 is a static method, then you are wrong and need to review your java textbook on static vs non-static functions and variables.

Similar Messages

  • How do I delete caches in Lion and which can I delete?

    How do I delete caches in Lion and which ones can be deleted?

    you can delete all of them, they will be recreated as soon as the app opens again.
    Clearing Local Caches
    quit all open apps
    open Finder press "shift+command+G" and type ~/Library/Caches
    Drag all files and folders to the trash
    Enter login password when prompted
    Reboot
    your system may seem slower after reboot, this is because the caches are being rebuilt.
    Clearing Application Caches
    quit all open apps
    open Finder Press "shift+command+G" and type /Library/Caches
    Drag all files and folders to the trash
    Reboot

  • How do I identify my account number and sortcode?

    How do I identify my account number and sortcode?

    You are talking about your bank account details I presume.   Apple will NEVER need your sort code or account number.   I hope you are not replying to a scam.   DO NOT communicate those details with anyone other than your bank people.

  • Premiere CS4 - How can you import QuickTime (.mov) videos and which settings for the sequence?

    Premiere CS4
    How can you import QuickTime (.mov) videos and which settings for the sequence?
    Please reply in plain English or if possible in German
    Greetings from Vienna, Peter

    I have not installed Quicktime.
    I got a few scenes (.mov) from a Canon Eos 70d.
    I want to create a short film (in Premiere CS4) with these scenes, mixed with photos and MP3 music.

  • I have got a lot of apps, which are not installed on any of my iDevices anymore. is there a possibility to remove all those apps from iTunes without searching which ones are, and which ones aren't installed on one of my iDevices?

    I have got a lot of apps, which are not installed on any of my iDevices anymore. is there a possibility to remove all those apps from iTunes without searching which ones are, and which ones aren't installed on one of my iDevices?

    Assuming all the device(s) have been synced to this computer as its Home computer. The easiest way would be to delete all the apps from iTunes. After which connect your device(s) to the computer (iTunes) and transfer purchases from the device(s) by right click (control click) the device name in the left sidebar and the click transfer purchases. When done only the apps on your device(s) will be in you iTunes library.
    Hope that helps

  • IPhone: which IKE proposal and which SA for cert auth

    Dear all,
    does anyone know which IKE proposal and which SA I need to manufacture to achieve certificate authentication with iPHONE and a VPN3000?
    I mean technically it must work, isn't it?
    --Joerg

    Under : Configuration\Policy Management\Traffic Management\SAs
    You will find the IPSec Proposals, not IKE. For IKE proposals, you need to go to :
    Configuration | Tunneling and Security | IPSec | IKE Proposals
    There you need to check if your proposal is in active proposals list or not. If not, you have to add it to Active Proposals.
    Hope this helps.

  • Convertion of class variable (static) into instance variable(non-static)!

    Dear all,
    got a slight different question.
    Is that possible to convert class variable (static) into instance variable(non-static)?
    If so, how to make the conversion?
    Appreciating your replies :)
    Take care all,
    Leslie V
    http://www.googlestepper.blogspot.com
    http://www.scrollnroll.blogspot.com

    JavaDriver wrote:
    Anything TBD w.r.to pass by value/reference (without removing 'static' keyword)?Besides the use of acronyms in ways that don't make much sense there are two other large problems with this "sentence".
    1) Java NEVER passes by reference. ALWAYS pass by value.
    2) How parameters are passed has exactly zero to do with static.
    Which all means you have a fundamentally broken understanding of how Java works at all.
    Am I asking something apart from this?
    Thanks for your reply!
    Leslie VWhat you're asking is where to find the tutorials because you're lost. Okay. Here you go [http://java.sun.com/docs/books/tutorial/java/index.html]
    And also for the love of god read this [http://www.javaranch.com/campfire/StoryPassBy.jsp] There is NO excuse for not knowing pass-by in Java in this day and age other than sheer laziness.

  • Is Static Function faster than non-static function

    Hi,
    I am wondering the performances issues of static Vs non-static function.
    To prevent object creation, I wrote some static function in my class but I wonder if it really did faster.
    any pointers in this direction will be helpful
    Jacinle

    to mattbunch
    I still haven't pinpointed exactly the system
    bottleneck
    but I do think finding a better approach at the
    earliest time is betterActually, the generally accepted best practice is to start with good algorithms and data structures, write the code, test the code, profile the code, and then do this kind of nickel and dime optimization after specific bottlenecks have been pinpointed. You absolultely should not make a static/non-static decision based on performance considerations. In fact, the idea that non-static is slower due to object creation is rather muddy thinking. You'd either already have the object and invoke its non-static method, or you'd invoke a static method. In the static case, your design would probably be different anyway, so you can't predict whether time saved by not creating an object would be lost by executing other code paths.
    The case in which you count object creation time is if you're creating an object just to call this one method on it and get that method's result, and then not using the object anymore. In that case, the method should be static--not for performance reasons, but rather because the way you are using it suggests that the appropriate design is for it to be static.
    >
    so many decision to be made in designing software
    I wonder if there is any practise I can follow
    See "Thinking in Java" by Bruce Eckel, and "Practical Programming in Java" by Peter Haggar

  • Static nested class VS non-static nested class ??

    we know static method can be called without creating an object and static variables are shared among objects.
    what is the difference between static nested class and non-static nested class ? When do we use them? what is the advantages of static nested class over non-static nested class in term of performance?

    From the JLS, chapter 8:
    A nested class is any class whose declaration occurs within the body of another class or interface. A top level class is a class that is not a nested class.
    This chapter discusses the common semantics of all classes-top level (?7.6) and nested (including member classes (?8.5, ?9.5), local classes (?14.3) and anonymous classes (?15.9.5)).
    So "nested" iff "not top level".From the JLS, chapter 8:
    An inner class is a nested class that is not explicitly or implicitly declared static.
    So a "static" nested class is a bit redundant, since a "non-static" nested class -- a nested class is either static or it isn't -- is more specifically referred to as an "inner class". That's my story and I'm sticking to it. :o)
    ~

  • Error: Cannot make a static reference to the non-static method

    Below is a java code. I attempt to call method1 and method2 and I got this error:
    Cannot make a static reference to the non-static method but If I add the keyword static in front of my method1 and method2 then I would be freely call the methods with no error!
    Anyone has an idea about such error? and I wrote all code in the same one file.
    public class Lab1 {
         public static void main(String[] args) {
              method1(); //error
         public  void method1 ()
         public  void method2 ()
    }

    See the Search Forums at the left of the screen?
    If you had searched with "Cannot make a static reference to the non-static method"
    http://search.sun.com/search/onesearch/index.jsp?qt=Cannot+make+a+static+reference+to+the+non-static+method+&rfsubcat=siteforumid%3Ajava54&col=developer-forums
    you would have the answer. Almost every question you will ask has already been asked and answered.

  • How do I identify my Duplicate Photos and Delete them?

    Don't ask me how it happended but I have managed to get a LOT of duplicate photos in my iphoto library.
    How can I identify those duplicates and then delete them automatically.
    An example of a duplicate would be: IMG12345.jpg and IMG12345_1.jpg etc
    Thanks,
    Steve

    Duplicate annihilator
    LN

  • I have an early 2008 iMac running iOs 10.5.8. I need to upgrade to at least iOs 10.6 snow leopard in order to install the driver for a new HP Office Jet Pro 8610 printer. How do I go about doing this, and which version of 10.6 would be best?

    I have an early 2008 iMac running iOs 10.5.8.It has a 2.8 Ghz Intel Core 2 Duo. I need to upgrade to at least iOs 10.6 Snow Leopard in order to install the driver for a new HP OfficeJetPro 8610 printer. Which version of 10.6 would be the best for this Mac and how do I go about upgrading?

    Click here and buy the DVD.
    (115929)

  • Just bought an Imac G5 but can't do much with it, how can I upgrade to neewer version and which is the next version after 10.4.11?

    HI, I just bought an Imac G5 with 10.4.11 OS in it but I can't do much with it.  I can't even wach Netflix on it because it needs a newer version of browser but I can't download newer version because My Mac's OS is to old, at least 10.6 needed.  Can anybody can help Me?  Thank you

    No, sorry. It was only ever available on Disc. You can search places like eBay or Amazon for a Retail Copy. Do not get the Grey Set as they are machine specific. I don't think 10.5 will let you do much more than 10.4 as you said you needed at least 10.6 which is not possible due to the age of your Mac.
    Cheers
    Pete

  • Have a download that will not download how can i identify what it is and how to delete it?

    Have Iphone 4 have a file that is "hanging out" that fails when I try to download.  What steps do I need to do to find out what the file is; and is it possible to delete?  THX

    Welcome to the Apple Community.
    You can see what's in iCloud collectively at settings > iCloud > storage & back up > manage.... You can only edit the data through the appropriate app (contacts, calendars etc)
    For problems with 3rd party apps, contact the developer.

  • How can I restore songs in download which are frozen and which I cannot import into my librairy?    cannot

    I

    Hello janine,
    Thanks for using Apple Support Communities.
    To resume a download in iTunes that was interrupted, please follow the directions in the article linked to below.
    iTunes: How to resume interrupted iTunes Store downloads - Apple Support
    Cheers,
    Alex H.

Maybe you are looking for

  • Dropdown menu buttons Edit and View not working in CC

    All other buttons working as normal but Edit and View highlight/pop but no menu drops down. Annoying, or what?! Thanks for any help

  • FM to create inspection lot same as in QA01

    Hi Experts, I need a function module to create inspection lot as in QA01.  Can you please help? Thanks, Vitz

  • Email address in knb1

    hi, when there is more than 1 email address maintained in knb1-intad (fd02 correspondence tab), email not able to generate. what can i do so that when more than 1 email address maintained, email also can created. thanks

  • So... Photoshop CS6 is that revolutionary?

    Hi folks. I'm a user of Photoshop since the 5.5 version and I do any kind of retouching and photompontages, but I've specialized myself in high-end beauty retouching. I work with thousand of layers, so I'm well equiped with enough RAM and BIG TIFF Fi

  • Early 2008 Mac Pro - Can't load Boot Camp drivers for Win 7 64

    Trying to install Win 7 64 bit on my early 2008 Mac Pro.  I downloaded the Boot Camp drivers 4.0.4033 and installed them on a USB drive but, for some reason, when I try the install them during the process, I get a message that my hardware is not reco