What will this TRICKY Java code print? NOT False!
VERY TRICKY Java programming exam question. What do you think it would print out – false? Wrong! The correct answer is true as there is a tricky base 8 (octal) conversion to base ten. #shorts #java
Code for 053==43 below:
class Main {
public static void main(String[] args) {
int x = 053;
int y = 43;
System.out.println(x==y);
int decVal = 26; // 26 in decimal
int octVal = 032; // 26 in octal
int hexVal = 0x1a; // 26 in hexadecimal
int binVal = 0b11010; // 26 in binary
}
}
Please SUBSCRIBE, LIKE, & SHARE for more videos and to stay updated with the latest important videos: https://www.youtube.com/c/CloudDataScience?sub_confirmation=1