Class 10
Class 10
============
Our program contains main method or not.
If JVM won't find main method then it will throw one runtime error called main
method not found.
signature:
--------
public static void main(String[] args)
If we perform any changes in above signature then JVM Will throw one runtime error
called main method not found.
public
------
JVM wants to call main method from anywhere.
static
------
JVM wants to call main method without using object reference.
void
-----
Main method does not return anything to JVM.
main
----
It is a identifier given to a main method.
String[] args
-----------
It is a command line argument.
ex:
javac Test.java
ex:
---
class Test
{
public static void main(String[] args)
{
System.out.println(args[0]);
System.out.println(args[1]);
System.out.println(args[2]);
System.out.println(args[3]);
}
}
System.out.println()
=====================
It is a output statement in java.
Whenever we want to display any data or user defined statements then we need to use
output stmt.
syntax:
-----
static variable
|
System.out.println();
| |
predefined predefined method
final class
Diagram: class10.1