Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
11th Edition
ISBN: 9780134671710
Author: Y. Daniel Liang
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 9.4, Problem 9.4.5CP

Explanation of Solution

Difference between constructor and method:

Constructor Method
The constructor functions are the special member functions which are designed to initialize the data members of a class. The constructor functions are automatically called by the compiler when declaring the object for the class. It is a collection of statements used for code reusability. These are also called as time savers as they save the time used to retype the code.
Constructor creates and initializes objects that don’t even exist yet Methods perform operations on the objects that already exist...

Blurred answer