Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Object reference not able to understand!  RSS feed

 
Ranch Hand
Posts: 35
Google Web Toolkit Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a doubt in inheritance . Even though i referred online tutorials, i'm not able to understand the concpet. Could any one make me clear??



Why we have to create a object like a above?? What's the use??
 
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The last line should be



Read a good book than online tutorials...
 
Greenhorn
Posts: 10
IntelliJ IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check the syntax of the sample code you've pasted
 
Ranch Hand
Posts: 384
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you cannot create an object of the PARENT class and refer to it using a REFERENCE variable of CHILD class ...

please re-read where you read from ...

 
Raga Jana
Ranch Hand
Posts: 35
Google Web Toolkit Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i misplaced the syntax.. What you said (Mehra) is right!
 
Lalit Mehra
Ranch Hand
Posts: 384
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your welcome ...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!