Monday's Programming Question
I had a couple of conversations around literals last week. Which leads me to this week's programming question. In Java, I can use a hexadecimal literal to assign a value to an int variable, like so:
int hexNumber = 0xEF;
and do the same using an octal literal:
int octalNumber = 0647;
The question is, can you write a for loop using hexadecimal and octal literals? More specifically can you write one that starts the iteration variable at 0xEF and stops looping once it equals the value 0647? And, how many times will the for loop go around?


No comments yet. Leave a Comment