Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data structure

Status
Not open for further replies.

EvilCabal

Programmer
Jul 11, 2002
206
CA
Hi,

I'm new to java, what is the equivalent in java of C data structure declared with struct?

Thanks!
 
You may declare a public class with public members:
Code:
public class Employee;
{
        public int id;
        public String name;
        public int department;
}
but only in rare cases you will find such a design in professional code.

I wouldn't call it an equivalent to C, because the principals of an OO-Language are different from C, and you can't translate concepts from one to the other.

seeking a job as java-programmer in Berlin:
 
If you're trying to build some kind of data container object, in Java you usually define the members as private variables with public get and set methods.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top