+ 1

When do we need too many objects to be made for a class?

8th Jun 2018, 12:10 AM
Saifur Rahman
10 Respostas
0
ThankyouDonna . but you didn't get my question?
8th Jun 2018, 2:29 AM
Saifur Rahman
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); } }
8th Jun 2018, 2:32 AM
Saifur Rahman
0
like in the above code their are two objects v1 & v2
8th Jun 2018, 2:32 AM
Saifur Rahman
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?
8th Jun 2018, 3:01 AM
Saifur Rahman
0
ohh. doesn't matter ? So, you work ? Donna
8th Jun 2018, 3:10 AM
Saifur Rahman