Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt????

 
Kasak Tahilramani
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ANs:1 with input 'A' output is 1
2 with input 'X' output is 0
3 with input 'D' output is 0
4 method fails to compile.

Myquestion: explain with detail,not able to understand...


[HENRY: Added Code Tags]
[ January 22, 2007: Message edited by: Henry Wong ]
 
Anton Uwe
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about this code...
 
fred rosenberger
lowercase baba
Bartender
Posts: 12180
34
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly do you not understand? what output do you think it should give?

Or is there a specific line/syntax you do not understand?
 
Bijendra S. Rajput
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,

I think the ans of this question is very simple. Whenever there is a comparison between two char with compound operator, actually we have to compare there unicode values.

So the ans is 1 and 2--------------
1 with input 'A' output is 1
2 with input 'X' output is 0

both are correct.

Please correct me if I am wrong.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic