Hey everyone, I have a question which is probably simple to most, but here it goes. I have this question in a class of mine and im trying to get put in the right direction. Here is the question: Create a class Student that represents student objects. A student has a last name, a first name, a home address, and a school address. The addresses are objects of a class Address. An address has a street address, a city, a state, and a zip code. Write a program StudentTest that creates and prints all information for two different students. So far I have this: public class Student { /* @param lname @param fname @param HomeAddress @param SchoolAddress */ public Student(String alname, String afname, String aHome, String aSchool) { lname = alname; fname = afname;
}
/** Add first name to list. @param Fname is the first name of the student */
public String getFname(String Fname) { fname = Fname; return fname; } /** Get last name from student @param Lname is the last name of the student */
Its fairly common to use get and set methods for retrieving and changing the internal data of an object. Some other class may need particular pieces of the data. The data parts can change.
A student object is basically then a bean or a java data object.
There are some very well written techniques on field and method design at: