+ 1

What is an object in Java

Java

4th Jul 2017, 2:00 AM
Harris Mulbah
Harris Mulbah - avatar
4 odpowiedzi
+ 20
an instantiation of a class
4th Jul 2017, 2:18 AM
NimWing Yuan
NimWing Yuan - avatar
+ 3
- An object is an instance of a class. - Objects are created and eventually destroyed (I mean that they live in the program for a limited time) and i can change it's properties. EX: Suppose we have a class called Shape that have methods and attributes. - attributes like : color - Length and so on. - methods like : draw (How i draw that shape?) An instance of the Shape class would be a specific Shape like circle, Rectangle or Square.
4th Jul 2017, 3:25 AM
Nayra Adel
Nayra Adel - avatar
+ 2
@Yassine Rajjaf Yes, you are right I just give him an example :) http://www.programmerinterview.com/index.php/java-questions/difference-between-object-and-class/
10th Jul 2017, 6:57 AM
Nayra Adel
Nayra Adel - avatar
0
@Nayra Adel, that's not true. That depends on the interface the object exposes. I can make one that retrieves information only, or have no props at all!
9th Jul 2017, 11:59 PM
Yassine Rajjaf
Yassine Rajjaf - avatar