Java Tutorial for Beginners – 16 – Constructors

In this tutorial I will show you the 2 basic constructor types.

Please watch all the beginning Java tutorials at: https://www.youtube.com/playlist?list=PLr6-GrHUlVf9SIx5cDhoEMknias5Xyv67&action_edit=1

Comments

deepcovergecko 1907 says:

Finally I have found an alternative for newboston

7906jun says:

ahhh constructor I have been struggling to wrap my head around it for past 2 days now. Frustrated…

Bhavani A says:

Finally I have found an alternative for newboston

scooterphoenix says:

This is MY 5th video on what a constructor is and it’s the BEST ONE I’ve watched. Thanks!

Adarsh Sidhu says:

Sir, can you ask the user for values instead of setting the values , that would be a lot helpful thank u..

Sean Flanagan says:

A constructive suggestion. If defining multiple variables of the same type, wouldn’t it make more sense to declare them all on the same line? For example, instead of:

“`
int firstNumber;
int secondNumber;
“`

how about:

“`
int firstNumber, secondNumber
“`

If you think about it, this would surely save time and reduce unnecessary coding. The less work you make for yourself, the easier it’ll be.

rbflowin says:

Where Bucky failed ,you won!

Leymr says:

Great tutorials man! Helping me alot! Thank you!

William Pylyser says:

I’m a little bit smarter after watching this. I needed this, thank you!

Prasad Hews says:

thank you sir. i learned it easily.

Azooz Jr says:

this is the best explanation of a constructor i have ever seen … thank you very much Sir

binalfew says:

what kind of screen casting are you using?

Hasin Sadat says:

Hello ! first of all thanks alot for the videos really really helping me understand my lessons and then i wanted to ask what are parameters and how do they work ?

Arthur Zaczek says:

Very simple explanation , now i got it ! Great Vid.
greetz form Germany

Grigory Bogush says:

Can you please tell me what it means to initialize an object? But without too much java terminology.

Brad Piper says:

These videos are super helpful!

Sean Flanagan says:

Thanks for the video. I understand the principle of the default constructor, but what about the other type of constructor? I’m prepared to watch this video again.

Jorge Ramos says:

Thank you sir. This is the one where I call it a night. I’m doing 15 videos a day so I can finish your java course in 4 days and let it all sink in. Best video tutorials I’ve seen in a long time.

SonnyDeez says:

how do you make it input instead of putting in the default numbers? like instead of having it 250,000   how can you make it so that you are inputting the numbers from the keyboard

Sunstriker11 says:

Freakin unbelievable. Thank you so much, best video yet that explains methods.

Bhargav Guntupalli says:

+EJ Media ur the best

ihonestytruthful says:

Excellent bro thanks!

Ammar Sadeq says:

just curious, when u say to check out ur other videos, does this mean that u know that some people may feel bored with java and not continue with it

Meshal Alawwad says:

Well explained.

nomad062 says:

I don’t see anyone else have the difficulty so perhaps I’m a doof. Where did we write the code for planets? As far as I can tell from the playlist I’ve done all the videos in order. The only superclass we created so far was Candy.

And thank you much for the videos I’m really finding this enjoyable.

_ _ says:

très utile 🙂

Unlim ited says:

My friend Im still on 15th tutorial but i have to congratulate you for explaining so good what you actually showing. I must tell you that i have bough several classes from udemy and treehouse and still i only understand why the hell we do some things on certain way ONLY from your videos. Again Greate Job! Thank you for these great tutorials

Anthony Neil says:

hey Ej, I did also use multiplication and it works….. 

package OtherLesson;

public class Addition {
int firstNumber;
int secondNumber;
int thirdNumber;

public int getnumber(){

return (firstNumber + secondNumber + thirdNumber);
}
public int getMultiplication(){
return (firstNumber * secondNumber * thirdNumber);
}
Addition (){
firstNumber = 10;
secondNumber = 20;
thirdNumber = 1;
}
Addition (int L, int B){
firstNumber = L;
secondNumber = B;
}
Addition (int A, int B, int C){
firstNumber  = A;
secondNumber = B;
thirdNumber =  C;
}

}

AYBIN. V. K says:

Thanks

shimy says:

slowly getting it now. damn im dumb

Ciaran McKenna says:

Excellent job, clear and expertly explained…. One question though, why the need for the Default Constructor if it’s not being used by the main method AdditionProgram ??? What purpose does it have for being created in the first place? The program runs fine with out it…

The Flying Cow56 says:

So helpful I was having trouble understanding constructors and this put me right on track. You deserve more subscribers than you have. Thanks!

NinaH says:

You’re so good at explaining this and waiting for us to let us think it through and process it in our heads – the only video where I have seen this done for a such difficult concept.

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!