The closest java equivalent would be a class with public fields and no methods. You don't see this very often since it's considered not good object-oriented programming. Better to make the fields private and create accessor methods. But sometimes you'll see it for a private nested class used for convenience inside another class. Check out the source code for ListIterator.Entry for an example.
"I'm not back." - Bill Harding, Twister
Joined: Aug 17, 2001
Thanks Jim, But where would I find the code for 'ListIterator.Entry'? Suresh
Your JDK should have a file src.jar or src.zip in the top directory. Unzip it (WinZip or the jar command can do this) and find the code for java.util.LinkedList. Entry is defined a static member class in that file. If too much of that is unfamiliar, then the short answer is no, Java doesn't have those features, and we do without them most of the time.
Jim Yingst wrote: Better to make the fields private and create accessor methods Even better to think about the actual problem you are trying to solve a bit more, and write methods which actually do something useful. Wanting to use classes which are just "structures" in an Object-Oriented language is often a sign that the design of the system is not well enough understood. As yourself what are the responsibilities and behaviour of this class? If you can't think of any, you may be better of not writing a new class at all, but just using one of the provided Collection classes or an array until you have more of a feel for the needs of the system.