Monday 5 October 2015

Java Tutorial : Java Underscore Characters in numeric literals


Click here to watch in Youtube :
https://www.youtube.com/watch?v=zGQLBEy6kB0&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java Underscore Characters in numeric literals
Java Tutorial : Java Underscore Characters in numeric literals
UnderScoreDemo.java
public class UnderScoreDemo
{

    public static void main(String[] args)
    {

        long creditCardNumber = 1234_5678_9012_3456L;

        System.out.println("creditCardNumber : " + creditCardNumber);

        long socialSecurityNumber = 999_99_9999L;

        System.out.println("socialSecurityNumber : " + socialSecurityNumber);

        float pi = 3.14_15F;

        System.out.println("pi : " + pi);

        long hexBytes = 0xFF_EC_DE_5E;

        System.out.println("hexBytes : " + hexBytes);

        long hexWords = 0xCAFE_BABE;

        System.out.println("hexWords : " + hexWords);

        long maxLong = 0x7fff_ffff_ffff_ffffL;

        System.out.println("maxLong : " + maxLong);

        byte nybbles = 0b0010_0101;

        System.out.println("nybbles : " + nybbles);

        long bytes = 0b11010010_01101001_10010100_10010010;

        System.out.println("bytes : " + bytes);

    }
}
Output
creditCardNumber : 1234567890123456
socialSecurityNumber : 999999999
pi : 3.1415
hexBytes : -1253794
hexWords : -889275714
maxLong : 9223372036854775807
nybbles : 37
bytes : -764832622
To Download VariableUnderScoreDemoApp Project Click the below link
https://sites.google.com/site/javaee4321/java/VariableUnderScoreDemoApp.zip?attredirects=0&d=1

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment