Literals/Integer: Difference between revisions

Content deleted Content added
Ada solution added
m →‎{{header|Java}}: Added long literal...it should be somewhere
Line 102: Line 102:
Leading 0 means octal, 0x or 0X means hexadecimal. Otherwise, it is just decimal.
Leading 0 means octal, 0x or 0X means hexadecimal. Otherwise, it is just decimal.


<lang java>
<lang java5>
public class IntegerLiterals {
public class IntegerLiterals {
public static void main(String[] args) {
public static void main(String[] args) {
System.out.println( 727 == 0x2d7 &&
System.out.println( 727 == 0x2d7 &&
727 == 01327 );
727 == 01327 );
}
}
}</lang>
}</lang>


Java has no way of specifying integers in binary
Java has no way of specifying integers in binary.

You may also specify a <tt>long</tt> literal by adding an <tt>l</tt> or <tt>L</tt> to the end. Ex: <tt>long a = 727L</tt>.


=={{header|JavaScript}}==
=={{header|JavaScript}}==