Q)What is System.out.println()?
A)System is a class
out is an object
println() is a method
Q) Why are using String args[] in main() method?
A)The main method is String args[] because the JVM to allot the String by default.
Q)What happens if String args[] is not written in main() method?
A)When main() method is written without Strig args[]:
public static void main()
the code will compile but jvm can't run the code. see the example
class A3{
public static void main()
{
System.out.println("this is SAT");
}
}
//>javac A3.java // compilation
//>java A3 //runtime
an error is ocurred the error is main() method is not found.
Anthor problem is the jvm start should start with main() method so the jvm always see for the main method.
A)System is a class
out is an object
println() is a method
Q) Why are using String args[] in main() method?
A)The main method is String args[] because the JVM to allot the String by default.
Q)What happens if String args[] is not written in main() method?
A)When main() method is written without Strig args[]:
public static void main()
the code will compile but jvm can't run the code. see the example
class A3{
public static void main()
{
System.out.println("this is SAT");
}
}
//>javac A3.java // compilation
//>java A3 //runtime
an error is ocurred the error is main() method is not found.
Anthor problem is the jvm start should start with main() method so the jvm always see for the main method.
out is object of which class man
ReplyDeleteout is the referance of printstream class
Deleteok. we can also call it as instance of java.io.PrintStream class
Delete