waht happens when a return type ,even void is specified for
a constructor?
Answer Posted / chandra rekha
The constructor has the same name as that of the class to
which it belongs to. When a return type or void is
specified,no error occurs.It will be considered as a method.
for example:
public class myclass
{
public myclass()
...
}this is considered as a contrustor
whereas,
public class myclass
{
public void myclass()
{
...
}will be considered as a method.....
Is This Answer Correct ? | 33 Yes | 3 No |
Post New Answer View All Answers
Give the difference between the println method and sqrt method?
Difference between association, composition and aggregation?
Is java a super set of javascript?
How do you do exponents in java?
How many types of voids are there?
How is string immutable in java?
Name four container classes.
What are constructors in java?
how its run?
What are thread safe functions?
What is module in project?
Can we convert integer to string in java?
What is serial version uid and its importance in java?
What is Enum in Java?
Can we define private and protected modifiers for the members in interfaces?