Skip to content

Instantly share code, notes, and snippets.

@rmg007
Created October 3, 2022 20:59
Show Gist options
  • Save rmg007/34eed06f6e5d05b8981a4d8ad514e59c to your computer and use it in GitHub Desktop.
Save rmg007/34eed06f6e5d05b8981a4d8ad514e59c to your computer and use it in GitHub Desktop.
learn and dive deep in Java Course. integral data types (Primitive data types in Java)
public class Main {
/*
byte (-128 -- 127)
short (-32768 -- 32767)
int (-2147483648 -- 2147483647)
long (-9223372036854775808 -- 9223372036854775807)
float: 7 decimal digits
double: 15 decimal digits
*/
public static void main(String[] args) {
byte myByte = (byte) -127;
short myShort = 32000;
int myInt = 20000;
long myLong = 922_337_203_685_477_580L;
float myFloat = 2.123456789F;
double myDouble = 2.123456789123456789;
System.out.println(myFloat);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment