The lessons provided links to the Sun tutorial site in the "Working with built-in classes" lesson ( http://www.javapassion.com/javaintro/index.html#Working_with_Java_classes), you did read them didnt you? I would suggest you read through them again, in particular the "Classes and Objects" link I have placed below.
http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html *"All classes have at least one constructor. If a class does not explicitly declare any, the Java compiler automatically provides a no-argument constructor, called the default constructor. This default constructor calls the class parent's no-argument constructor, or the Object constructor if the class has no other parent. If the parent has no constructor (Object does have one), the compiler will reject the program."* You should definitely read through these and try to understand, constructors are one the basics you should definitely get a handle on. If after reading you still have questions then post them here. Mike On Wed, Jan 21, 2009 at 3:53 PM, Srini Srinivasan < [email protected]> wrote: > Thanks. I am still not there with the term Constructor yet. May be I can > understand little more that time. > > Thanks, > Srini. > > ------------------------------ > *From:* Patricio Martínez León <[email protected]> > *To:* [email protected]; Free Java Programming Online Training > Course By Sang Shin <[email protected]> > *Sent:* Wednesday, January 21, 2009 9:06:04 AM > *Subject:* [java programming] Re: public class definition question > > > The first definition is for the class. The second is for the constructor, > which enables users of this class to instantiate it. > > Best regards > > Patricio > -----Mensaje original----- > De: [email protected] > [mailto:[email protected]] En nombre de Srini S > Enviado el: miércoles, 21 de enero de 2009 9:54 > Para: Free Java Programming Online Training Course By Sang Shin > Asunto: [java programming] public class definition question > > > Hi, > > Can someone please help me to understand why we define the class > "NumWords" twice on this example: > public class NumWords { > > /** Creates a new instance of NumWords */ > public NumWords() { > } > > The comment says that it creates a new instance of NumWords. But I am > not sure what is the purpose of doing that and how that helps in > subseqeunt coding. This example is part of the lab document for topic > "Control Structure" > > Thanks, > Srini. > > > > __________ Information from ESET Smart Security, version of virus signature > database 3785 (20090121) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com > > > > > __________ Information from ESET Smart Security, version of virus signature > database 3785 (20090121) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com > > > > __________ Information from ESET Smart Security, version of virus signature > database 3785 (20090121) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
