New course! Every coder should learn Generative AI!
Try a free lesson+ 1
when we create int variable and asssign 012 what is the out put and explain , some code porvided
public class number_print { public static void main(String[] args) { int x = 003; int y = 070; int m = 012; System.out.println(x); System.out.println(y); System.out.println(m); } }
1 Answer
+ 4
When you begin an int with 0, it is a special literal format for octal number system (similar to binary but with 8 digits).
070 = 0*64 + 7*8 + 0*1 = 56
012 = 0*64 + 1*8 + 2*1 = 10