devxlogo

Why Static Methods Can Only Make Calls to Static Methods

Why Static Methods Can Only Make Calls to Static Methods

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

 class TstApppublic static void main (String args[])Next_Level(args[0]);}public void Next_Level(String Incoming_String)System.out.println(Incoming_String);}}

size=3>
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.

devx-admin

Share the Post: