Created
February 16, 2020 22:12
-
-
Save alimuhammed056/75997aea3be094f441f41ee40459aa0f to your computer and use it in GitHub Desktop.
Java1
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 | |
========================================================= | |
A)Primitive | |
1- Integers (byte - short - int - long ) | |
8 16 32 64 | |
default | |
*/ | |
byte a = 120; | |
byte b = 120; | |
//System.out.println(a+b); | |
int c = a+b; | |
System.out.println(c); | |
byte d = 2; | |
long s = a+b; | |
byte f = (byte)s;//cast | |
// System.out.println(d); | |
System.out.println(s); | |
System.out.println(f); | |
System.out.println(Byte.MIN_VALUE+" -> "+Byte.MAX_VALUE); | |
System.out.println(Short.MIN_VALUE+" -> "+Short.MAX_VALUE); | |
System.out.println(Integer.MIN_VALUE+" -> "+Integer.MAX_VALUE); | |
System.out.println(Long.MIN_VALUE+" -> "+Long.MAX_VALUE); | |
} | |
} |
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 Test { | |
public static void main(String [] args){ | |
System.out.println("Hello Java"); | |
System.out.println("fuhs9696iuadsuodh"); | |
int x = 10; | |
System.out.println("x="+x); | |
System.out.println("\"x= "+x+"\""); | |
// System.out.println("C:\\Users\\NH\\Documents\\NetBeansProjects\\Java1"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment