Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java certification question

 
mahesha
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, freinds


i want to know how would we write a code in the java for this statement

the statement is ...

IN JAVA OBJECTS CANNOT CONTAIN ANOTHER OBJECT

my requirement is how to show or write a code even though this is wrong

PLEASE REPLY URGENT


Edit by mw: Removed shouting from subject line.
[ August 02, 2007: Message edited by: marc weber ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, please take some time to read the Naming Policy, and change your name accordingly. "mahesh .a mahesh" is not valid. Thank you.

Secondly, be careful not to duplicate posts :
http://www.coderanch.com/t/407785/java/java/Java-certification
http://www.coderanch.com/forums/
Writing a new topic all uppercase does not help either.

And last, please be patient. Read the following document, and you'll understand why "PLEASE REPLY URGENT" is not going to help you getting answers faster.

Thank you for your comprehension.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java does have the concept of inner classes, about which there is a chapter in the Java Tutorial. Is that what you are asking about?
 
mahesha
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know there is no inner classs but i wnt to know how the code looks like
object cannot contain other objects.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mahesha,
thank you for changing your name, but it still does not apply to the policy. You must set both first and last names (both different). Can you please adjust it one more time ? Thank you
 
David McCombs
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mahesha:
i know there is no inner classs but i wnt to know how the code looks like
object cannot contain other objects.


What do you mean? Java has inner classes so does that qualify as objects in objects?

What about composition? Does that qualify?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12124
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David McCombs:
What about composition? Does that qualify?

I'd say no. the object is not CONTAINED in the object. you have a reference to an object that is somewhere else.
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"contained" is a suspicious word in this context, I'd say it's too subjective.

How about an array of objects? Would the array qualify as "containing" other objects?

Why do we want to know about "containment"? What's our goal here?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bert Bates:
"contained" is a suspicious word in this context, I'd say it's too subjective...

Agreed. We might even argue (for example) that a String "contains" the Object it's descended from.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, the topic shouts, "JAVA CERTIFICATION QUESTION." But what does this have to do with certification?
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the original posting:
IN JAVA OBJECTS CANNOT CONTAIN ANOTHER OBJECT


In Java, objects cannot contain other objects, but they can contain references to other objects. The actual objects are all in the heap.

Kaydell
 
Scott Selikoff
author
Saloon Keeper
Posts: 4014
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"mahesha"

Your name still does not conform to the JavaRanch Naming Policy. Please review the policy and update it appropriately. This is your second warning.

Scott Selikoff
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Mahesha,

I think its hi time you may have to please look at your "diplay name" as our bartenders/moderators have been telling you so politely. I would suggest no matter what that should be your first plan of action!

As kaydell told, No object really "has" or "contains" another object insdie. What it matters it the posesssion of "references" to any other objects (you can even consider the reference as a handle or a pointer using which we know the way to get to an object).

Obviously, all the objects are entities residing in "Heap Memory".

Do you need to prove this concept with an example? Is that what your main question?
[ December 17, 2007: Message edited by: Raghavan Muthu ]
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also as marc suggested, can the thread's subject be changed?

As its obviously misleading and of course that only dragged me here!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic