+ 1
When do we need too many objects to be made for a class?
10 Respostas
0
ThankyouDonna . but you didn't get my question?
0
public class Vehicle {
int maxSpeed;
int wheels;
String color;
double fuelCapacity;
void horn() {
System.out.println("Beep!");
}
}
class MyClass {
public static void main(String[ ] args) {
Vehicle v1 = new Vehicle();
Vehicle v2 = new Vehicle();
v1.color = "red";
v2.horn();
System.out.println(v1.color);
v2.color="green";
System.out.println(v2.color);
}
}
0
like in the above code their are two objects v1 & v2
0
yea Donna but i want to ask that it can be done by one object .
I got you ,we can use as many objects .
By the way you are great at coding .
Have you ever used Unity Engine?
0
ohh. doesn't matter ?
So, you work ? Donna