Dear all,
I have a question concerning question n�11 of Marcus Green's Mock Exam n�3.
class Base{
public void Base(){
System.out.println("Base");
}
}
public class In extends Base{
public static void main(
String argv[]){
In i=new In();
}
}
1) Compile time error Base is a keyword
2) Compilation and no output at runtime
3) Output of Base
4) Runtime error Base has no valid constructor
Answer 2.
That's correct while executing with command line.
But first time, I runned this program into
IDE Eclipse and this didn't compile with the following error message:
this method has a constructor name So my question is: is it allowed to use a method with the same name as the class (or constructor) and return type? I trust more the command-line than the IDE Eclipse but I would like to be sure...
Thanks in advance for your response,
Cyril.
SCJP 1.4, SCWCD, SCBCD, IBM XML, IBM Websphere 285, IBM Websphere 287