Give the output of the following Java statements: (i)"TRANSPARENT".toLowerCase()
(ii) "TRANSPARENT".compareTo("TRANSITION")
Answers
Answer:
String a = "Java is a programming language\ndeveloped by\t\'James Gosling\'";
System.out.println(a);
Java is a programming language developed by ‘James Gosling’
d) Differentiate between break and System.exit(0).
The break keyword is used to terminate a loop or a switch statement.
System.exit(0) is used to terminate a program.
e) Write a statement in Java for:
Math.sqrt((Math.pow(a + b), 3) / Math.abs(a - b))
f) What is the value of m after evaluating the following expression:
m -= 9 % ++n + ++n / 2; when int m = 10, n = 6;
m = m – (9 % ++n + ++n / 2)
= 10 – (9 % 7 + 8 / 2)
= 10 – (2 + 4)
= 10 – 6
= 4.
g) Predict the output of the following:
(i) Math.pow(25, 0.5) + Math.ceil(4.2)
= 5.0 + 5.0
= 10.0
(ii) Math.round(14.7) + Math.floor(7.9)
15.0 + 7.0
= 22.0
Answer:
transparent
Explanation:
As the .toLowerCase() method turns all the letters to lower case letters.