+91 81900 98289

Java Intro

Java is a general-purpose language used for web services, Android apps, and large business systems. You write a class, compile it to bytecode, and a Java Virtual Machine runs that bytecode.

The same class file can run on Windows, Linux, or macOS when a current JDK is installed. That is the idea behind "write once, run anywhere": the JVM, not the source file, talks to the operating system.

Example

The class is public, so the file must be named Intro.java. main is the method the JVM looks for when you run the class.

public class Intro { public static void main(String[] args) { System.out.println("Java runs on the JVM"); } }
A .java file is source. javac produces a .class file. The java command starts the JVM and calls main.