QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A ICSE2014-03J #7420

Question:

What will be the output when the following code segments are executed?
(i)
String s = "1001";
int x = Integer.valueOf(s);
double y = Double.valueOf(s);
System.out.println("x=" +x);
System.out.println("y=" +y);

(ii)Β System.out.println(“The King said \”Begin at the beginning!\” to me.”);

Answer:

(i) s = g1001
x = 1001
y = 1001.0
Output will be

x=1001
2 y=1001

(ii) The King said β€œBegin at the beginning!” to me.
\” is an escape sequence which prints ”