aspose file tools*
The moose likes Beginning Java and the fly likes Constructor - Which are the difference between methods and constructors? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructor - Which are the difference between methods and constructors?" Watch "Constructor - Which are the difference between methods and constructors?" New topic
Author

Constructor - Which are the difference between methods and constructors?

André Asantos
Ranch Hand

Joined: Nov 23, 2009
Posts: 234
Constructor - Which are the difference between methods and constructors? Give me an
exemple please...

André AS
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
Constructors run any time a class is created and don't have a return type.

I recommend reading this.


SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
André Asantos
Ranch Hand

Joined: Nov 23, 2009
Posts: 234
Thank you very much...
André AS
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40061
    
  28
The name of the constructor is exactly the same as the name of the class. Remember: no return type.
Danish Sualeh
Greenhorn

Joined: Oct 06, 2005
Posts: 11
To add , constructors should really be concerned with initializing a class instance.

Doing too much work in the constructor may cause problems down the line such as when you want to unit test your code , etc.

In such cases , work should be delegated to methods
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Constructor - Which are the difference between methods and constructors?