i have confusion, like when we give Char var='A';how is it stored in memory???is its value dat is 65 stored in bits??if yes wat is the value of 'a' (smallcase)...
the value of A-Z is 65-90,
i have program which prints A-Z,

class chararray{

public void createArray(){

char[] s;//declaring array

s=new char[26];//assigning size

for(int i=0; i<26; i++)

{

s[i]=(char)('A' +i);

}

for(char values : s)

System.out.println(values);

}

public static void main(String[] args){

chararray c=new chararray();

    c.createArray();

}
}

i want to print a-z in program.. if i give s=(char)('a' +i); i am not getting output as a,b,c,d......y,z. can anybody explain??please

Recommended Answers

All 2 Replies

char is an integer data type, the representation as a character is for convenience's sake only.

i know characters are represented interms of integer values. can u tel me wat is da value of 'a'. and the program i ve given prints A to Z, since A 's value is 65 i ve given ('A' + i) wer
the logic i thought is A 's value is increments so prints A,B,C,D....Z. if i give ('a' +i).. y i am not getting alphabets in small case (a,b,c,d........to z.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.