Sunday, 18 October 2015

Core Java with OCJP_SCJP Language Fundamentals Part-5 __ Literals part-2



Boolean Literals

               The only allowed values for boolean datatype are true, false.

             Which of the following are valid declaration

         
  
     

                                           

character literal

A char literal can be represented as a single character with in single quotes.
Ex:
                      

we can represent a char literal by using it’s Unicode value. For the allowed Unicode values are 0 to 
65535.
Ex:
         

we can represent a char literal by using Unicode representation which is nothing but
\uxxxx’
Ex-
    
                                                                 

                                 
  
                       








we can also represent a char literal by using escape character.
Ex:
      
                                                              
The following is the list of all possible escape characters in java.             
                                                            
Which of the following char declarations are valid?  
       

                                      

  String literal


                      A sequence of character with in double quotes is String literal.

No comments:

Post a Comment