Skip to content

devakashtiwari/Java-Day-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation


πŸ“Œ Java β€œHello, World!” Program – Line by Line Explanation

public class Hello {
  • public β†’ Makes the class accessible from anywhere.
  • class β†’ Keyword used to define a class in Java.
  • Hello β†’ Name of the class. ⚠️ Rule: The class name must match the file name (Hello.java).

    public static void main(String[] args) {
  • public β†’ Allows the JVM to access this method.
  • static β†’ Enables the method to run without creating an object of the class.
  • void β†’ Indicates the method does not return any value.
  • main β†’ Entry point of the Java program (execution starts here).
  • String[] args β†’ Command-line arguments passed to the program.

        System.out.println("Hello, World!");
  • System β†’ A built-in Java class.
  • out β†’ Output stream connected to the console.
  • println() β†’ Prints text to the console and moves to a new line.
  • "Hello, World!" β†’ The message displayed on the screen.

    }
  • Closes the main method.

}
  • Closes the Hello class.

βœ… Output

Hello, World!

About

Print First Program in Java .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages