Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Advanced
Feb 1, 2001

Why Static Methods Can Only Make Calls to Static Methods


Write the following code, compile it, then try to run it:
 
class TstApp

public static void main (String args[])

Next_Level(args[0]);
}

public void Next_Level(String Incoming_String)

System.out.println(Incoming_String);
}
}

It is very simple code but it will not work. This is because, in the parent class, main is a static method whereas Next_level() is not a static method.
Shantanu Garg
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date