Example
public class
ClassA {
private int
a;
private char
x;
public void
ClassA () {
a=5;
x='c';
}
}
Solution
In the exaple
void
has been used as the return type for constructor.There should be no return type for constructors.Otherwise, the compiler treats it as a normal method
public class
ClassA {
private int
a;
private char
x;
public
ClassA () {
a=5;
x='c';
}
}