About Question enthuware.ocpjp.v21.2.3669 :
Posted: Fri Oct 03, 2025 2:48 pm
Integer r = i1+1000;
System.out.println(r); //This will print 3000
and
Integer r = i1 + Integer.valueOf(s1.replace("_", ""), 16); //This will throw an exception
System.out.println(r);
These two are right answers ?
Why is this being reported as one of the right answers ?
String s1 = "2_0";
Integer r = 100 + Integer(s1); //This will cause compilation failure
System.out.println(r);
Is there something wrong here?
System.out.println(r); //This will print 3000
and
Integer r = i1 + Integer.valueOf(s1.replace("_", ""), 16); //This will throw an exception
System.out.println(r);
These two are right answers ?
Why is this being reported as one of the right answers ?
String s1 = "2_0";
Integer r = 100 + Integer(s1); //This will cause compilation failure
System.out.println(r);
Is there something wrong here?