Question: 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
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();?
a. myBike.height = 26;
b. myBike.model = "Cyclone";
c. myBike.wheels = 3;
d. myBike.model = 108;
e. Bicycle.height = 24;
f. Bicycle.model = "Hurricane";
g. Bicycle.int = 3;
h. Bicycle.model = 108;
i. Bicycle.wheels = 2;
j. Bicycle yourBike = myBike;
Step by Step Solution
3.40 Rating (175 Votes )
There are 3 Steps involved in it
a Illegal b Legal ... View full answer
Get step-by-step solutions from verified subject matter experts
