Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Size and signedness of Java ints and longs
//Title of this code //'main' method must be in a class 'Rextester'. import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int zero = 0; int one = 1; int minusone = -1; int effeff = 0xffffffff; //int effeffell = 0xffffffffL; // Gives: // source_file.java:15: possible loss of precision // found : long // required: int // int effeffell = 0xffffffffL; // ^ long longeffeffell = 0xffffffffL; System.out.println("zero = " + zero); System.out.println("one = " + one); System.out.println("minusone = " + minusone); System.out.println("effeff = " + effeff); //System.out.println("effeffell = " + effeffell); System.out.println("longeffeffell = " + longeffeffell); System.out.println("effeff < 0 = " + (effeff < 0)); System.out.println("effeff < zero = " + (effeff < zero)); //System.out.println("effeffell < 0 = " + (effeffell < 0)); //System.out.println("effeffell < zero = " + (effeffell < zero)); System.out.println("longeffeffell < 0 = " + (longeffeffell < 0)); System.out.println("longeffeffell < zero = " + (longeffeffell < zero)); } }
run
|
edit
|
history
|
help
0
javaLP(Multi)
pk3
jb7.0 extends.override
apple1
1a
Current date and time in java
Fibonacci numbers 0 - 1_000
Simple imitation for show banners on priorities
java
Check Input