Tuesday, 9 August 2016

Q-5 is it possible to call the main method explicitly just like a normal java method?

ans : yes,it is possible to call main method explicitly just like normal java method but to call the main() we can use some other class method;

for ex:test.java
class test
{
public  static void main(String[] args)
{
  
  System.out.println("main method test clsss");
     }
}
class demo
{
public static void main(String[] args)
{
           String[] s={"c","java","c++","linux"};
  test.main(s);
  System.out.println("demo  class main methid");
}
}

compile and run test.java file:





run demo class:





No comments:

Post a Comment