_
_
_umr2017-01-27 17:09:36
Java
_umr, 2017-01-27 17:09:36

Did not catch up with the paragraph on the declaration, creation and initialization of the object, explain?

The book says:
Three steps towards declaring, creating and initializing an object.
1. We declare a reference variable
Dog myDog = new Dog();
2. We create an object
Dog myDog = new Dog();
3. We associate an object and a link
Dog myDog = new Dog();
But the code is the same everywhere, what is it? What does it mean? Isn't it possible to declare and create and initialize an object with one such line? Usually this happens, but the illustrations in the book confused me a little.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2017-01-27
@Umr001

Formatting probably forgotten
1. Declare a reference variable
2. Create a
3. Associate the object and the reference
Dog myDog = new Dog();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question