Answered step by step
Verified Expert Solution
Link Copied!

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)

image text in transcribed

image text in transcribed

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions