• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling an object  RSS feed

 
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,

There are two different class definitions say classA and classB and i create two objects of each of the classes, say ObjA and ObjB respectively.

Can i call the object of classB from object of classA?

Using code like this: objA.objB

Is this a bad practice of coding? Is it legal?

Kindly provide your help.
Regards,
Vijay
 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you can't. The syntax "objA.objB" works only when objB is a member variable in classA. I don't know what you mean exactly by "calling an object". You don't "call" an object.

[ October 15, 2007: Message edited by: Jesper Young ]
 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doubt cleared!!

Thanks for the help Jesper


Regards,
Vijay
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!