Skip to content

Instantly share code, notes, and snippets.

@alimuhammed056
Created February 16, 2020 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alimuhammed056/75997aea3be094f441f41ee40459aa0f to your computer and use it in GitHub Desktop.
Save alimuhammed056/75997aea3be094f441f41ee40459aa0f to your computer and use it in GitHub Desktop.
Java1
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);
}
}
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