[Training Video - 2] [Java Introduction] [Install Java and Eclipse, Create Class]

时间:2023-03-08 20:42:04

Download Java : https://java.com/en/download/

Download Eclipse : https://www.eclipse.org/downloads/

[Training Video - 2] [Java Introduction] [Install Java and Eclipse, Create Class]

Code :

public class FirstJavaClass {

	// function
public static void main(String[] args) { System.out.println("hello world");
// syso -> cntrl+space
System.out.println(65465); // DATATYPES
int x = 100; // cannot store decimals - 32 bits
System.out.println(x);
x=200;
System.out.println(x); long var =3000L;// cannot store decimals - 64 bits
char c='y'; // just one place
boolean b=true; // true or false System.out.println(3>12); int q=100;
int w=200; boolean x1=q>w; System.out.println(x1); // IF statements
if(q<w){
System.out.println("q is lesser");
}else if(q==w){
System.out.println("q is equal to w");
}else{
System.out.println("q is greater");
} // STRING class
String str = "hello how are you";
}
}

  

Result :

hello world
65465
100
200
false
false
q is lesser