123k views
0 votes
3. Suppose that a class named Bicycle contains a private nonstatic integer named height, a public nonstatic String named model, and a public static integer named wheels. Which of the following are legal statements in a class named BicycleDemo that has instantiated an object as Bicycle myBike new Bicycle C);? f. Bicycle. model Hurricane a. myBike height 26; b. my Bike model Cyclone g. Bicycle. int 3 3; c. myBike Wheels 3 d. my Bike .model 108; i. Bicycle wheels 2 e. Bicycle height 24; j. Bicycle yourBike myBike

1 Answer

4 votes

Answer:

The solution to the given problem is provided below.

Step-by-step explanation:

a.) myBike.height = 26; Not Legal statement

b.) myBike.model = “Cyclone”: Legal statement

c.) myBike.wheels = 3; Legal statement

d.) myBike.model = 108; Not legal statement

e.) Bicycle.height = 24; Not Legal statement

f.) Bicycle.model = “Hurricane”; Not legal statement

g.) Bicycle.int = 3; Not Legal statement

h.) Bicycle.model = 108; Not Legal Statement

i.) Bicycle.wheels = 2; Legal Statement

j.) Bicycle yourBike = myBike; Legal Statement

User Pimaster
by
6.1k points