Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

When to use static methods

807600Jul 29 2007 — edited Jul 29 2007
Hello there,
I am not clear about the difference between a static method and a non-static method. I need to know when I should use one instead of the other. For example, what is the functional difference between the two methods below?
public static void doSomething() 
{
    int i = 1 + 2;
}

public void doSomething() 
{
    int i = 1 + 2;
}
Thanks,

ue_Joe
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 26 2007
Added on Jul 29 2007
3 comments
135 views