Computer Applications
Write two characteristics of a constructor.
Java Constructors
4 Likes
Answer
Two characteristics of a constructor are:
- It has the same name as that of its class.
- It has no return type, not even void.
Answered By
1 Like
Related Questions
What is that class called which does not have a public constructor ?
When is a constructor automatically invoked ?
Write a class specifier (along with its constructor) that creates a class student having two private data members : rollno and grade and two public functions init( ) and display( ).
(Do not write full definitions of member functions except for constructor).Can you think of the benefits of a private class if any ? What are they ?