You are viewing a single comment's thread. Return to all comments →
We do not need to cast explicitly. We are just required to check the applicable ranges.
if(x>=-128 && x<=127) System.out.println("* byte"); if(x>=-(Math.pow(2,15)) && x<=(Math.pow(2,15)-1)) System.out.println("* short"); if(x>=-(Math.pow(2,31)) && x<=(Math.pow(2,31)-1)) System.out.println("* int"); if(x>=-(Math.pow(2,63)) && x<=(Math.pow(2,63)-1)) System.out.println("* long");
Seems like cookies are disabled on this browser, please enable them to open this website
Java Datatypes
You are viewing a single comment's thread. Return to all comments →
We do not need to cast explicitly. We are just required to check the applicable ranges.