Java Reference
In-Depth Information
isLowerCase('a') is true
isUpperCase('a') is false
toLowerCase('T') is t
toUpperCase('q') is Q
4.8
Use print statements to find out the ASCII code for '1' , 'A' , 'B' , 'a' , and 'b' .
Use print statements to find out the character for the decimal codes 40 , 59 , 79 , 85 ,
and 90 . Use print statements to find out the character for the hexadecimal code 40 ,
5A , 71 , 72 , and 7A .
Check
Point
4.9
Which of the following are correct literals for characters?
'1' , '\u345dE' , '\u3fFa' , '\b' , '\t'
4.10
How do you display the characters \ and " ?
4.11
Evaluate the following:
int i = '1' ;
int j = '1' + '2' *( '4' - '3' )+ 'b' / 'a' ;
int k = 'a' ;
char c = 90 ;
4.12
Can the following conversions involving casting be allowed? If so, find the converted
result.
char c = 'A' ;
int i = ( int )c;
float f = 1000.34f ;
int i = ( int )f;
double d = 1000.34 ;
int i = ( int )d;
int i = 97 ;
char c = ( char )i;
4.13
Show the output of the following program:
public class Test {
public static void main(String[] args) {
char x = 'a' ;
char y = 'c' ;
System.out.println(++x);
System.out.println(y++);
System.out.println(x - y);
}
}
4.14
Write the code that generates a random lowercase letter.
4.15
Show the output of the following statements:
System.out.println( 'a' < 'b' );
System.out.println( 'a' <= 'A' );
System.out.println( 'a' > 'b' );
System.out.println( 'a' >= 'A' );
System.out.println( 'a' == 'a' );
System.out.println( 'a' != 'b' );
 
 
Search WWH ::




Custom Search