Video Lecture
Hello world Program
public class Main { public static void main(String[] args) { System.out.println("Hello world"); } }
Important points
- Every line of code must be inside a
class
. - we named class Main.
- A class must start with an uppercase first letter.
- Java is case-sensitive: "MyClass" and "myclass" contain different meaning.
OUTPUT
Hello world
public class Application
- In java class name will be same as a file name.
- The name of file which is also the class name contain first letter capital
- Every single line of code written in the class in this called Application
public static void main(String[] args)
- Public : This is access modifier due to java can execute method at run time
- Static : Java virtual machine(JVM) load class in memory and call method
- void : Method does not return any thing.
- String[] args : Method take only one argument as a string.
System.out.println();
- System : It defined final class which is java.lang.package
- out : It is like a print stream . which is also member of System class
- println() : It print any argument passed to it.
0 Comments