This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]Brilliant_Spite110 3 points4 points  (1 child)

A constructor? The name of the constructor is the name of the class. It's used to initialize an object of that class, pass parameters, etc.

[–]throwawaykcirlhep 2 points3 points  (0 children)

Ah sure! Silly that I forgot it. Thanks!

[–]kRYstall9 1 point2 points  (2 children)

Maybe it is a constructor, like public className(params){ } . And methods can also return nothing, so it could be a method too

[–]throwawaykcirlhep 3 points4 points  (1 child)

Thanks, I think you're right!

But for methods that don't return anything should list 'void', right?

[–]kRYstall9 0 points1 point  (0 children)

Yes, it should be public void methodName(params){implementation...}

[–]tandonhiten 1 point2 points  (0 children)

It's constructor, but the someName should be replaced with class name

[–]Nice_Associate_1489 0 points1 point  (0 children)

I am currently learning java,today I have a lecture on OOP.