For example if i use this code private StudentRecord studentRecord= new StudentRecord();
it works fine..... but with this line private StudentRecord studentRecord; it doesnt.... What is the difference between this 2 line of code? which is the correct one?? On Wed, Feb 18, 2009 at 3:38 PM, Vasile Braileanu <[email protected] > wrote: > Keep private, is a good programming habit. In fact is a requirement for > Java Beans. > > private StudentRecord studentRecord; > > and make "setters" > public void setStudentName(String name){ > studentRecord.setName(name); > } > > you can create a constructor too (for initializing StudentRecord). In > project is not specified, just to have functions to set and get variables > from StudentRecord > > I have wrote them both (setters/getters) and constructor. > It is specified however you must show some values from Student. > I overwritten toString() but I think getters are better. For the purpose of > the exercise I think is ok. > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
