Introduction to Java basics
Sun, 17 Nov 2024
Download and install jdk. Jdk contains
Install the jdk by following the installation instruction.
Set Up Environment Variables
JAVA_HOME
(Not mandatory):JAVA_HOME
%JAVA_HOME%\bin
.JAVA_HOME
also.- Click ok and save the changes.
Verify Installation
java -version
javac
(Java Compiler):javac -version
public class FirstProgram {
public static void main(String... args){
System.out.println("Hello world");
}
}
.java
extension with file name same as class name. FirstProgram.java
.javac FirstProgram.java
FirstProgram.class
. See the .class
extension.Êþº¾ =
java/lang/Object <init> ()V
java/lang/System out Ljava/io/PrintStream;
Hello world
java/io/PrintStream println (Ljava/lang/String;)V FirstProgram Code LineNumberTable main ([Ljava/lang/String;)V
SourceFile FirstProgram.java ! *· ± ‰ % ²
¶ ±
.class
file, we can use the following commandjava FirstProgram
Hello world
This is a comment 1.
This is a comment 2.