- 2
Elaborate more about classes, Object and Methods for Java programming Language
With the help of real-life analogy, explain what are classes, objects, and methods as used in object-oriented programing? * Your answer
3 Réponses
+ 1
Imagine you have a class Car in GTA 5, and you are one of the programmers. You create a Car object(Car c1=new Car(blue, sanchez)). Then you start it(c1.start()). Then you make it go random ways so that the player doesn't feel alone(c1.goRandom())(usage of method "goRandom()" here). And if the user enters cheat bigbang, you blast the car(c1.explode())(usage of another method). Hope my example makes sense😗😇
This is how I always imagined using object oriented programming languages like Java and C++ and etc...