0

v1.horn()

Vehicle.horn() preferable? Can use Vehicle.horn() even without v1=new Vehicle()?

25th Nov 2016, 7:43 AM
Saad KEBIR
Saad KEBIR - avatar
1 Odpowiedź
+ 2
If your method is static than yes. You don't need to create an object for that. you can access that method with class name like Class_Name.Method_Name but if it is not static you have to create an object for that.
25th Nov 2016, 7:55 AM
Aditya kumar pandey
Aditya kumar pandey - avatar