Question: Java. Can you explain me the following code? public class NFE { public static void main(String[] args) { String s = 42; try { s
Java. Can you explain me the following code?
public class NFE {
public static void main(String[] args) {
String s = "42";
try {
s = s.concat(".5");
double d = Double.parseDouble(s);
s = Double.toString(d);
int x = (int)
Math.ceil(Double.valueOf(s).doubleValue());
System.out.println(x);
} catch (NumberFormatException e) {
System.out.println("bad number");
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
