Hello Roger, Even though it is a method, it's slightly different than other methods you know in that it does not return anything. It is referred to as a constructor. In this case it is the default constructor of the class. If you leave it out, the program will still compile and the program will run. If you leave it out, the compiler will insert it. I think Sir Shin put it there so that we know that it is suppose to be there. In some codes that we will write, we will have to use the constructors and you will then see the importance of it then.
Hope that helps. Foyah On Mon, Jan 19, 2009 at 2:03 PM, Roger O'Dell <[email protected]>wrote: > Typing out the code for example 2.21 into Netbeans results and an error. > The following line(s) need to be removed for the code to compile. There is > no return type and it has nothing to do with the rest of the code. The > example compiles without it. Did anyone else notice this when they did the > lab? > > /** Creates a new instance of InputFromKeyboardJOptionPane */ > public InputFromKeyboardJOptionPane() { > } > > > Roger O'Dell > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
