Java constructors vs. methods: differences

Forums GeneralJava constructors vs. methods: differences
Staff asked 1 year ago

Hello everyone

I’m learning Java right now, and I’m interested in the distinctions between constructors and methods. I’ve read a little about it online, but I’m still unsure if I really get the differences.

Can someone provide me with a quick summary of the differences between Java constructors and methods?

Answers (1)

Add Answer
Staff answered 1 year ago

Here is a quick summary of how Java constructors and methods differ from one another:

Constructors: Special procedures called constructors are used to initialize objects. When an object is created, they are called.
Methods: Methods are used to perform actions on objects. They can be called at any time during the execution of a program.

For more detailed answers refer to Java interview questions and answers.

Subscribe

Select Categories