Consider the following statements.public class Circle{ private double radius; public Circle() { radius = 0.0; } public Circle(double r) { radius = r; } public void set(double r) { radius = r; } public void print() { System.out.println(radius + " " + area + " " + circumference); } public double area() { return 3.14 * radius * radius; } public double circumference() { return 2 * 3.14 * radius; }}Circle myCircle = new Circle();double r;Which of the following statements are valid in Java? (Assume that console is Scanner object initialized to the standard input device.)(i) r =
console.nextDouble(); myCircle.area = 3.14 * r * r; System.out.println(myCircle.area);(ii) r = console.nextDouble(); myCircle.set(r); System.out.println(myCircle.area());
A. Only (i)
B. Only (ii)
C. Both (i) and (ii)
D. None of these
Answer: B
You might also like to view...
The Mid function allows you to select the starting point in a text string to select characters, unlike the Left function which always starts with the first character of the text string
Indicate whether the statement is true or false
Match the following terms to their meanings:
I. Unbound control II. Text box control III. Line control IV. Ctrl + End V. Calculated control A. Moves to the end of a report B. A label control on a report C. A control whose source of data is an expression, rather that a field D. Places a line on the design of a report E. Have three properties relating to tab order: Tab index, Tab Stop and Auto Tab