as far as i know , the constructor return nothing , not even void ,
and also
return ;
inside any method means to return void .
so in my program
public class returnTest {
public static void main(String[] args) {
returnTest obj = new returnTest();
System.out.println("here1");
}
public returnTest ()
{
System.out.println("here2");
return ;
}
}
i am calling
return;
which will be returning VOID , but constructor is not supposed to return anything ,
the program compiles just fine .
please explain .
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…