Java constant basis _Java

 

1  / * 
2      constants:
 3          during program execution, it can not change the value of the amount of
 4      constant classification:
 5          String constants: double quotes contents enclosed "the Hello, World!."
 . 6          integer constants: Without decimals 666, -88.
 7          decimal constant: with decimals 13.14, -5.21.
 8          character constants: single quotes content 'a', '0', ' I'.
 9          boolean: bool representing true and false to true, to false.
 10          empty constants: a special value, null null
 . 11   * / 
12 is  public  class ConstantDemo {
 13 is      public  static  void main (String [] args) {
 14          // character constant 
15         System.out.println ( "the Hello, World!" );
 16          System.out.println ( "Hangzhou University of Electronic Science and Technology" );
 17          System.out.println ( "------------- --- " );
 18          // integer constant 
. 19          System.out.println (666 );
 20 is          System.out.println (-88 );
 21 is          System.out.println (" ---------- ------ " );
 22          // decimal constant 
23 is          System.out.println (13.14 );
 24          System.out.println (-5.21 );
 25          System.out.println (" ------- --------- " );
 26          //Character constants 
27          System.out.println ( 'A' );
 28          System.out.println ( '0' );
 29          System.out.println ( 'I' );
 30          System.out.println ( "---- ------------ " );
 31          // boolean constants 
32          System.out.println ( to true );
 33 is          System.out.println ( to false );
 34 is          System.out.println (" - -------------- " );
 35          // null constant can not be directly output
 36          // System.out.println (null); given 
37      }
 38 }

 

Guess you like

Origin www.cnblogs.com/NiBosS/p/11929655.html