| | |
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
android api apple applet application arc arguments array arrays automation binary bluetooth c++ chat class classes client code codesnippet compiler component csv database doctype draw ebook eclipse error event exception fractal freeze game givemetehcodez graphics gui html ide image input integer intellij iphone j2me java java.xls javaprojects jmf jni jpanel jtable julia linux list login loop loops mac map method methods mobile netbeans newbie number online oracle page parameter print problem program programming project recursion reporting rotatetext scanner screen server set size sms socket sort sql string superclass swing system template test testautomation threads time title tree tutorial-sample windows working






