0

Simple question about java objects.

maby im sleepy but after you create an instance of class does a declared variable in class become an object of class after initializing it with an instance of class? example public Class House{ public String bricks; main... bla bla House h = new House(); << instance of class House h.bricks = "Red"; |_______________ | | is this all an object now? or is it just h pointing?

12th Sep 2017, 10:34 PM
D_Stark
D_Stark - avatar
4 odpowiedzi
+ 2
h is the only object, bricks is a property of the object.
12th Sep 2017, 10:38 PM
Enzo
Enzo - avatar
+ 1
yeah thats essentially what it does if im understanding what you mean.
12th Sep 2017, 10:56 PM
Enzo
Enzo - avatar
+ 1
no probs thank u
12th Sep 2017, 10:57 PM
D_Stark
D_Stark - avatar
0
does the object just point at the instance to give it a value?
12th Sep 2017, 10:44 PM
D_Stark
D_Stark - avatar