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 -~----------~----~----~----~------~----~------~--~---
