-2

I have a code like this, but I don't know why result variable have false value after execution the code

int x = 234;
boolean result = (x<0250);

and also why the following code doesn't work properly?

System.out.println(0250);

it prints 168 !! why?!

2 Answers2

0

Integer literals starting with 0 are octal (base 8) not decimal (base 10).

Your options are

hexadecimal = 0x0C;
decimal = 12; 
octal = 014;
binary = 0b1100;
Thilo
  • 257,207
  • 101
  • 511
  • 656
0

A number that looks like 0x followed by an integer (using the digits 0-9 and A-F) is a hexadecimal (base 16) number.

A number that looks like 0 followed by an integer (using the digits 0-7) is an octal (base 8) number.

Erick G. Hagstrom
  • 4,873
  • 1
  • 24
  • 38
Gary Y Kim
  • 79
  • 4