This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Dot Syntax for navigating classes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Dot Syntax for navigating classes?

Tye Solan
Greenhorn

Joined: Feb 17, 2011
Posts: 3
Is there away to make

Root Workspace=new Root();
Animal Cow=new Animal();
//Parent Cow to workspace
Workspace.Cow.sound="Moo";
Workspace.Cow.color="White, black spots";

where Root and Cow are blank classes with a few properties.
So how do I parent Cow to Root? I think it has to do with super classes or something?

class Root
{

}

class Animal
{
String sound="";
String color="";
}
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
Yes, it has something to do with super classes or something. If you want Root to be a super class (parent) of Animal then you define Animal as:

If you want Animal to be a parent of Root then you define Root as:
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

How does this question differ from the earlier one you never returned to?
http://www.coderanch.com/t/529886/java/java/Data-Structure

Oh, and you didn't return to this one either, not even to SayThanks.
http://www.coderanch.com/t/527777/java/java/Method-other-class-as-if


luck, db
There are no new questions, but there may be new answers.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38033
    
  22
Darryl Burke wrote:How does this question differ from the earlier one you never returned to?
http://www.coderanch.com/t/529886/java/java/Data-Structure . . .
Agree. We only allow One Thread Per Question, so I am closing this thread..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dot Syntax for navigating classes?
 
Similar Threads
Generics Question
Generics.
why this code gives compiler error.
polymorphism
Why can only "real" dog bark?