alternative
  • Home (current)
  • About
  • Tutorial
    Technologies
    SQL -Structured Query Language
    Python
    Ethical Hacking
    Java
    .net Framework
    Placement Preparation
    Quantitative Aptitude
    View All Tutorial
  • Quiz
    SQL -Structured Query Language
    Quantitative Aptitude
    Java
    View All Quiz Course
  • Q & A
    Quantitative Aptitude
    Java
    View All Q & A course
  • Programs
  • Articles
    Artificial Intelligence & Machine Learning Project
    How to publish your local website on github pages with a custom domain name?
    How to download and install Xampp on Window Operating System ?
    How To Download And Install MySql Workbench
    How to install Pycharm ?
    How to install Python ?
    How to download and install Visual Studio IDE taking an example of C# (C Sharp)
    View All Post
  • Tools
    Program Compiler
    Sql Compiler
    Replace Multiple Text
    Meta Data From Multiple Url
  • Contact
  • User
    Login
    Register

Java - 1st Java Program Explanation - Program Syntax Tutorial

 

// Java 1st Hello World Program

public class FirstProgram{

    public static void main(String[] args) {

        System.out.println("Hello World");

/* This Line will Print Hello World */

   }

}

 

Run Program

Java FirstProgram Explanation

 

  • Every line of code must be written inside class. In our case class name is FirstProgram
  • Class Should Always start with Capital letter.
  • Java File name and Class name should be same. In our case file name FirstProgram.java should match with class name FirstProgram.
  • Java is case-sensitive , FirstProgram and firstprogram has different meaning.

Syntax Explanation

  • Class Keyword- It is used to declared a classname in java.For example in below example we use class FirstProgram{…} . So here we declare FirstProgram as a classname.
  • Public keyword- It is access modifier. Which means it is publicly (visible) to all.
  • Static keyword- If we declare any method as static, then it will automatically invoke by JVM. Therefore main method is automatically invoke by JVM. Because it is static method.
  • void is the return type of the method. It means it doesn't return any value.
  • Main Method

Every java program has main() method.Which is entry point of a program.

  • String[] args
  • System.out.println()

It is used to print message. As shown in example we have printed  “Hello World”.Same as printf in C Programming.

      How Java Program Run?

Compilation:

When we compile Java program using javac tool, java compiler converts the source code (i.e FirstProgram.java) into byte code (FirstProgram.class).

Java

Java

  • Introduction
  • Installation and running a first java program
    • JDK Installation
    • Environment Variable Path Setup
    • Running a first java program
  • 1st Java Program Explanation
    • Program Syntax
  • JDK,JRE,JVM
    • JRE
    • JDK
    • JVM
  • Thing to know before proceed
    • Variable
    • Datatype
    • Operator
    • Keyword
    • Access Modifier
  • Decision Control and looping statement
    • If-else
    • Switch
    • For
    • While
    • do-while
    • break
    • continue
  • Object-Oriented Programming (OOPS) Concept
    • About OOPs
    • Object & Class
    • Inheritance
    • Polymorphism (Runtime & Compile Time)
    • Abstraction (Using abstract and interface)
    • Encapsulation

About Fresherbell

Best learning portal that provides you great learning experience of various technologies with modern compilation tools and technique

Important Links

Don't hesitate to give us a call or send us a contact form message

Terms & Conditions
Privacy Policy
Contact Us

Social Media

© Untitled. All rights reserved. Demo Images: Unsplash. Design: HTML5 UP.