This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The output of the statements is
The fi rst int displayed from line 8 is positive because the string “ hello ” is greater than
“ goodbye “ . The actual value of the positive number is normally irrelevant, and for String
objects it represents the difference between the fi rst unequal characters between the two
strings. Line 9 compares “ Hello ” to “ goodbye ” and outputs - 31 because H is uppercase and
appears before all lowercase letters. Therefore, “ Hello ” is less than “ goodbye “ . Similarly,
“ hello ” is greater than “ Hello ” on line 10, which outputs 32 . Line 11 outputs 0 because
the two strings are equal


Sun Certified Programmer
for Java® Platform, SE6
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!