Cat c = new Cat(); here i created cat variables or objects? yes i initialized the Cat c variable hence its an object....Give ur opinion....Thanks...!
anupam jha
Level 7
variables
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
anupam jha
5 January 2021, 14:43
Cat c is a variable. but Cat c = new Cat () ; is an object? fine Thanks.
0
Guadalupe Gagnon
4 January 2021, 15:05
here you create a variable "c" which is one way to create an address in the computer's memory for you to access an object
↓
Cat c = new Cat();
↑
here you create an object which is set to the address in memory of variable "c"
All that is done is that you combined two lines of code into one, which makes the code a little cleaner and easier to understand: It's the same as if you did this:
0