aspose file tools*
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
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: 4658
    
    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: 39834
    
  28
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..
 
 
subject: Dot Syntax for navigating classes?