Register on the forum now to remove ALL ads + popups + get access to tons of hidden content for members only!

Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > Java


Thread Tools Rate Thread Display Modes
Old 11-16-2017, 01:28 AM   #1
Registered User
Join Date: Nov 2017
Posts: 3,518
What is constructor?

What is constructor?
sunled is offline   Reply With Quote

Old 11-30-2017, 01:38 AM   #2
Registered User
Join Date: Sep 2017
Posts: 123
A constructor is a special method of a class or structure in object-oriented programming that initializes an object of that type. A constructor is an instance method that usually has the same name as the class, and can be used to set the values of the members of an object, either to default or to user-defined values.
travelowebseo is offline   Reply With Quote
Old 12-01-2017, 10:31 PM   #3
michael Amaral
Registered User
Join Date: May 2017
Posts: 59
A constructor in Java is a block of code similar to a method that's called when an instance of an object is created. Here are the key differences between a constructor and a method: A constructor doesn't have a return type. The name of the constructor must be the same as the name of the class.
michael Amaral is offline   Reply With Quote
Old 12-01-2017, 10:41 PM   #4
Registered User
Join Date: Dec 2016
Location: 33 Browning St, Yokine WA 6060, Australia
Posts: 182
A constructor is a block of code that initializes the newly created object. A constructor resembles an instance method in java but it’s not a method as it doesn’t have a return type. In short constructor and method are different(More on this at the end of this guide). People often refer constructor as the special type of method in Java.
The Dog Line - Experts in Electric Dog Collars: Dog Bark Collars to Reduce or Stop Excessive Barking, Electronic Dog Fence for escape-artist and Remote Dog Training Collars for Dog Obedience Training like Recall
TheDogLine is offline   Reply With Quote
Old 12-16-2017, 04:12 AM   #5
Registered User
Join Date: Oct 2017
Posts: 82
if we did'nt set constructor java will itself create a contructor
karthiknagaraja is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the difference between a constructor and a method? chinmay.sahoo Javascript 3 01-25-2017 09:26 PM
Creation without a Constructor Function chinmay.sahoo Programming General 0 09-23-2016 05:14 AM
What is constructor overloading in java ? Kunal Java 2 09-01-2016 12:09 AM
What are Class, Constructor and Primitive data types? chinmay.sahoo Programming General 2 06-03-2016 03:15 AM
Parent constructors called implicitly inside a class constructor? binarynpixel PHP / mySQL 0 08-03-2013 02:58 AM

All times are GMT -7. The time now is 06:26 AM.

Powered by vBulletin Copyright © 2013 vBulletin Solutions, Inc.