Question: Consider the following line of code for calling a method named methodX where d ata is an integer and varData is an double variable. methodX

Consider the following line of code for calling a method named methodX where data is an integer and varData is an double variable.

methodX (data, varData );

Which one of the following method headers is valid for methodX?

None are correct.
public static void methodX ( double list, int data)
public static void methodX ( double list, double data)
public static void methodX ( String list, int data)

public static void methodX ( int varData, double data)

The non-static methods of a class are called the ____ methods of the class.

update
instance
frozen

permanent

Which of the following is an example of a local identifier in the following code?

01: public class scopeRule 02: { 03: static double intRate = 0.055; 04: static String name; 05: static int t;

06: public static int main(String[] args) 07: { 08: int first; 09: double u, t; 10: String str; 11: //. . . 12: }

13: public static int first(int x, int y) 14: { 15: int t; 16: }

17: public static double salary; 18: }

Which of the following identifiers in the following code are usable in method first?

01: public class scopeRule 02: { 03: private double intRate = 0.055; 04: private static String name; 05: private int t;

06: public static int main(String[] args) 07: { 08: int first; 09: double u, t; 10: String str; 11: //. . . 12: }

13: public static int first(int x, int y) 14: { 15: int t; 16: }

17: public double salary; 18: }

Only salary (Line 17)
Both intRate (Line 3) and salary (Line 17)
Only intRate (Line 3)
first (Line 8)

name (Line 4)

Which of the following identifiers in the following code are usable in another class?

01: public class scopeRule 02: { 03: private double intRate = 0.055; 04: private static String name; 05: private int t;

06: public static int main(String[] args) 07: { 08: int first; 09: double u, t; 10: String str; 11: //. . . 12: }

13: public static int first(int x, int y) 14: { 15: int t; 16: }

17: public double salary; 18: }

first (Line 13)
salary (Line 17)
Both intRate (Line 3) and salary (Line 17)

intRate (Line 3)

In the method first, the programmer wishes to update the value stored in the variable intRate (Line 3). Which of the following is correct?

01: public class scopeRule 02: { 03: private double intRate = 0.055; 04: private String name; 05: private static int t;

06: public static int main(String[] args) 07: { 08: int first; 09: double u, t; 10: String str; 11: //. . . 12: }

13: public static int first(int x, int y) 14: { 15: double intRate; 16: intRate = x * y; 17: }

18: public double salary; 19: }

The code is correct. Nothing needs to be done.
Update it in the method main (Line 6)
Rename the variable on Line 15 to something else.
Write another non-static method to do so.

Consider the following class definition.

public class Cylinder extends Object { private double height;

public Cylinder (double radius, double h) { super(radius); height = h; } public double getRadius() { return super.getRadius(); }

public String toString() { return (getRadius() + " " + height); }

public double surfaceArea() { return 2 * 3.14 * getRadius() * height; }

public double volume() { return 3.14 * getRadius() * getRadius() * height; } }

Suppose that you have the following declaration.

Cylinder cyl = new Cylinder(1.5, 10);

Which of the following statements are valid in Java?

System.out.print(cyl.surfaceArea);
cylinder.print();
cyl.volume();
cyl.surfaceArea();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!