1.Why the compiler gives a warning on line of "class Human"saying that Multiple markers at this line,The type Human is already defined and Occurrence of 'Human'
2.Even I change line "System.out.println(aPerson.getHeight());" into "aPerson.getHeight();", it still print output in the console window.How does print works in JAVA?
public class HelloWorld{
public static void main(String[] args){
Human aPerson = new Human(160);
System.out.println(aPerson.getHeight());
}
}
class Human{
/**
* constructor
*/
Human(int h){
this.height = h;
System.out.println("I'm born");
}
/**
* accessor
*/
int getHeight(){
return this.height;
}
int height;
}