Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For MyProg mp new MyProg(), which one is not ok? class MyProg i int i; static int j: void mlO static void m20 a. System.out.println(mp.j)
For MyProg mp new MyProg(), which one is not ok? class MyProg i int i; static int j: void mlO static void m20 a. System.out.println(mp.j) d. mp.ml0: b. System.out.println(MyProg.i); c. MyProg.m20; e. None of the above Class Circle has a double getRadius() method. Which one is valid? public class Foo Circle c-new Circle) public static void main (String[] args) methodl ; public void methodl ) method2 public void method2 O System.out.println("What is radius"c.getRadius )) a. methodl cannot be called in the main method. b. method2 should be declared before methodl, since method2 is invoked from method1 c. Variable c must be declared in method2, since c is used in method2 d. The program has a compilation error in the println statement where c may not be defined. e. The program compiles fine, but it has a runtime error because c has not yet been instantiated when the println statement is executed. Wh ich one is correct? class Boxi Box this.volume (1,2,3); void volume (int w, float h, double d) System.out.println (w*h * d) public static void main (String args [])f Box b = new Box ( ); b.volume (1,2,3) a. The output is 6.0 and 6.0 d. b.volume(1,2,3) cannot be called. b. this.volume(1,2,3) cannot be called. c. Cannot be compiled. e. The volume method needs to be static What is the output of this program? int sum = 0; for (int = 0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started