What is wrong in the following code public class Test public
What is wrong in the following code? public class Test {public static void main(String[] args) {method1(); private static void method1() {Circle c; System.out.println(\"What is radius \" + c_middot getRadius()); method should be declared before main, since it is used in main, method is a private method and cannot be invoked in the main method. The program has a compilation error in the println statement where c has not been initialized. The program compiles fine, but it has a runtime error because variable c has not been initialized.
Solution
a) is true as java is advanced enough to handle these situations.
b) is true as main and method1 both lie in the same class so private does not affect.
c) is also true as program will have compilation error because c is not initialized and since circle is a user defined class java cannot automatically assign it.
d) is false as it will be compilation error
![What is wrong in the following code? public class Test {public static void main(String[] args) {method1(); private static void method1() {Circle c; System.out. What is wrong in the following code? public class Test {public static void main(String[] args) {method1(); private static void method1() {Circle c; System.out.](/WebImages/39/what-is-wrong-in-the-following-code-public-class-test-public-1119379-1761595315-0.webp)