| | |
Use of constructors
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Can you elaborate a little more on the question? All object creation is done through constructors. If no constructor is specified, the compiler will supply a default empty constructor that basically does nothing. If you wish to provide info that initializes some values in the object when it's created, you provide a constructor for those parameters and initialize those values in that constructor.
Do you think that user of your application will be interested in reading your code and seting all variables by him self? Or do you think all variables are always initialized?
Last edited by peter_budo; Oct 19th, 2007 at 12:08 pm.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- Why constructors don't have return types (C++)
- Taking address of constructors?? (C++)
- C++ Tic Tac Toe using classes & operator overloading (C++)
- Confusion with constructors (Java)
- what is the effect of using constructors in the program? (Java)
- How to do constructors (Java)
Other Threads in the Java Forum
- Previous Thread: how to make a textfield in html form readonly in servlet
- Next Thread: export to html
| Thread Tools | Search this Thread |
Tag cloud for Java
@param android animated api appinventor apple applet application arguments array arrays automation binary bluetooth c++ chat chatprogramusingobjects chooser class classes client code codesnippet compiler component coordinates database doctype draw eclipse editor error event exception file fractal freeze game givemetehcodez graphics gui guidancer health helpwithhomework html ide image input int integer j2me java javaprojects jmf jni jpanel jtable julia linux list login loop map method methods mobile netbeans newbie nonstatic number oracle page plazmic print problem program programming project recursion scanner screen sell server set sharepoint size sms socket sort sourcelabs sql string swing system test testautomation threads time tree windows






