Loading...
The following code to compare two strings is compiled, the following syntax error was displayed – incompatible types – int cannot be converted to boolean. Identify the statement which has the error and write the correct statement. Give the output of the program segment. void calculate() { String a = "KING", b = "KINGDOM"; boolean x = a.compareTo(b); System.out.println(x); }
John was asked to write a Java code to calculate the surface area of a cone, the following code was written by him: Surface area of cone is A=πrl l = √(r² + h²) class area { double area (double r, double h) { double l, a; a=22.0/7*r*l; l=Math.sqrt(r*r+h*h); return a; } } Specify the type of the error in the above program, correct and write the program to be error free.
© 2026 PadhAiPro. This question is provided for educational purposes.