Consider the following class definition.public class Cylinder{ private double baseRadius; private double height; public Cylinder () { baseRadius = 0; height = 0; } public Cylinder (double l, double h) { baseRadius = l; height = h; } public void set(double r, double h) { baseRadius = r; height = h; } public String toString() { return (baseRadius + " " + height); } public double SurfaceArea() { return 2 * 3.14 * baseRadius * height; } public double volume() { return 3.14 * baseRadius * baseRadius * height; }}Suppose that you have the following
declaration. Cylinder cyl = new Cylinder(1.5, 10);Which of the following sets of statements are valid in Java?(i) cyl.surfaceArea(); cyl.volume(); cyl.print();(ii) print(cyl.surfaceArea); print(cyl.volume());
A. Only (i)
B. Only (ii)
C. Both (i) and (ii)
D. None of these
Answer: D
You might also like to view...
Is compliance without enforcement effective?
What will be an ideal response?
You can declare two variables with the same name in __________.
a. a method one as a formal parameter and the other as a local variable b. a block c. two nested blocks in a method (two nested blocks means one being inside the other) d. different methods in a class
Microsoft Word 2013 outlines that can be imported into a presentation could have all of the following file extensions EXCEPT:
A) .docx. B) .rtf. C) .wpd. D) .doc.
________ will return the total interest paid within a time range on a loan
Fill in the blank(s) with correct word