Why system.out.println(011) prints 9 and not 3?
bigzos
0
Light Poster
Recommended Answers
Jump to PostLiterals starting with 0 are parsed as octals. Start with
0x
for hexadecimals and0b
for binary literals in Java 7+. Lower Java versions have no binary literals, soInteger.parseInt("10101010", 2);
should be used instead. Hope this helps.
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.