I wrote a very simple Java program :
class test {
public static void main (String args[])
{
int i = 23;
int j = i/10;
System.out.println ("Value of i: " +i);
System.out.println ("Value of j: " +j);
}
}
The output is as expected - i = 23 and j = 2
Now, I kept changing the value of i in the program. And the output started to change.
The value of i = 02 and the output becomes - i = 2 and j = 0
The value of i = 023 and the output becomes - i = 19 and j = 1
Now I am confused. When I gave the value of i = 023 in the program, in the output I expected to get i = 23 and j = 2. But why is i becoming 19?