Page 1 of 1

[HD Pg 0, Sec. 4.7.0 - exercise]

Posted: Wed Aug 26, 2020 12:19 am
by sandeepnegi1996
This question is from the book OCP Java se 11 part 1
Exercise 4.7
Ques 4

Add an instance variable of type Bird in Bird. Initialize this variable
on the same line using "new Bird()" syntax. Instantiate a Bird object
in TestClass's main and execute it. Observe the output.


Here I am not able to understand what is the meaning of initialize the variables and the meaning of instantiate a Bird Object. Can you tell me the solution for this one :joy:

Re: [HD Pg 0, Sec. 4.7.0 - exercise]

Posted: Wed Aug 26, 2020 1:21 am
by admin
Please go through section 1.3 Declaration and Definition, which explains the meaning of initialization of a variable and section 4.1 Declare and instantiate Java objects, which explains instantiation.