Question: 6. What is wrong in the following code? public class Test ( a. b. c. d. public static void main(String[] args) { methodl ();
6. What is wrong in the following code? public class Test ( a. b. c. d. public static void main(String[] args) { methodl (); } private static void methodl () { Circle c; System.out.println ("What is radius " + c.getRadius ()); } } methodl should be declared before main, since it is used in main. methodl is a private method and cannot be invoked in the main method. The program has a compilation error in the printin statement where c has not been initialized. The program compiles fine, but it has a runtime error because variable c has not been initialized.
Step by Step Solution
There are 3 Steps involved in it
This is a code snippet written in Java showing a class Test with a main method that calls another me... View full answer
Get step-by-step solutions from verified subject matter experts
