Please have a look into the below code
int a =10;
int b =20;
System.out.println((a>b)?'a':65);//A
System.out.println((a>b)?a:65);//65
System.out.println((a>b)?"a":65);//65
Can somebody explain me why it is displaying "A" if I made variable 'a'
as a character? And it should display 65 if I made "a"
as a string?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…