Sunday, February 22, 2009

source code to show the char literals



// source code to show the char literals

package literals;

public class CharLiteralExample {


public static void main(String[] args) {
// not valid declarations

// char ch=a;
// char ch=’ad’;

// valid declarations

char c1='a';
char c2=97; // here output we will get 'a'
char c3=060; // we can declare with octa,hexa notaions also
char c4=0x67;


}

}



0 comments:

Post a Comment