What is Java Programming Developed by Sun Microsystems in 1995, Java is a highly popular, object-oriented programming language. This platform independent programming language is utilized for Android development, web development, artificial intelligence, cloud applications, and much more.

In this tutorial, we will cover everything from the basics of Java syntax to advanced topics like object-oriented programming and exception handling. So, by the end of this tutorial, you will have a strong understanding of Java and be ready to start writing your own Java applications. So let’s get started on this comprehensive Java programming tutorial!

First Java Program

// A Java program to print "Hello World"

public class GFG {

public static void main(String args[])

{

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

}

}
Java Basic Syntax
Java program is an object-oriented programming language, that means java is the collection of objects, and these objects communicate through method calls to each other to work together. Here is a brief discussion on the Classes and Objects, Method, Instance variables, syntax, and semantics of Java.

Basic terminologies in Java

  1. Class:The class is a blueprint (plan) of the instance of a class (object). It can be defined as a logical template that share common properties and methods.
    • Example1: Blueprint of the house is class.
    • Example2: In real world, Alice is an object of the “Human” class.
  2. Object:The object is an instance of a class. It is an entity that has behavior and state.
    • Example: Dog, Cat, Monkey etc. are the object of “Animal” class.
    • Behavior: Running on the road.
  3. Method:The behavior of an object is the method.


Basic Syntax
import java.util.*;
public class GFG {
public static void main(String[] args)
{
System.out.println("GeeksforGeeks!");
}
}
Data Types in Java Data types in Java are of different sizes and values that can be stored in the variable that is made as per convenience and circumstances to cover up all test cases. Java has two categories in which data types are segregated

  • Primitive Data Type: such as boolean, char, int, short, byte, long, float, and double
  • Non-Primitive Data Type or Object Data type: such as String, Array, etc.