Sample Java Program - explaining each words
Lets take sample program in java and will research each and everthing
Class Test{
public static void main(String args[])
{
System.out.println("Welcome to Java program");
}
}
Now thing about following question :
1 Why the main method inside a Class rather than outside of class?
2 Why they decared main method as public ?
3 Will it compile if I declare private or other access specifier ?
4 why main class declared as static method? what is the purpose for static here ?
5 What happened if I decalre 'int' instead of void and return 0? Will it compile ?
6 Can I change the argument args[] to s[]?
7 Shall I call a main method from other class ?
8 what is System ?what is out ? what is println?
Understand the question and answer it .
No comments:
Post a Comment