This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Circle { | |
// double radius; | |
// public void area(){ | |
// System.out.println(3.14*radius*radius); | |
// } | |
public double square(double radius){//4 | |
return radius * radius;//16 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NewClass { | |
public static void main(String[] args) { | |
if(args!=null && args.length>0){ | |
System.out.println(args[0]); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
/* | |
Calculator | |
*/ | |
public class NewClass { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NewClass { | |
public static void main(String[] args) { | |
int x = 3; | |
int y = 4; | |
int z = 5; | |
if(x>y && x>z){ | |
System.out.println("Ok"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//2- Floating points | |
//--------------------- | |
// float32 bit - double 64bit | |
public class NewClass { | |
public static void main(String[] args) { | |
double d = 3.2; | |
float e = 0.5f; | |
float w = (float)0.5; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NewClass { | |
public static void main(String[] args) { | |
int x = 10; | |
//type var-name = value ; | |
/* | |
Data Types | |
------------------- | |
A)Primitive B)Object Reference |