0

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

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by palavi
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.