It is there to show you that it belongs there. You are taking a course, so of course things are going to seem redundant!
You don't really need a constructor if you are doing a "Hello World" program, because as you go on you will learn that every Class is derived from the Object Class, which means it is a child class and it uses it's parent's (Object Class) Constructor if one is not provided. Stephen On Wed, Feb 25, 2009 at 1:04 PM, Anton Shaykin <[email protected]>wrote: > > I don't know why I got replies to my normal address and can't see any > posts here, but anyway. You told me that it's a default constructor. > But isn't default constructor called "default" because it's used by > compiler without need to declare it? In other words, code is compiled > and works perfectly well even without declaring default constructor, > and in this case I think compiler use its own default constructor, so > we don't need to declare one, do we? > It's like when you use default access modifier - there's no need to > specify it by 'default' keyword. > So my opinion is that use of such a constructor is redundant. > Does anybody else have different opinion. Please, share it. Thank you. > > On Feb 25, 7:50 pm, Anton Shaykin <[email protected]> wrote: > > Really. Why do we create empty instances for every class, like this: > > > > public class StudentRecord { > > > > /** Creates a new instance of StudentRecord */ > > public StudentRecord() { > > } > > > > } > > > > Does it make sense at all? What's the need to do it? > > Thank you. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
