Created
October 3, 2022 20:59
-
-
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)
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 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