I have a question related to the below code .
the question is : i think that when i create the object "Temp x = new Temp();"
and call the method using " x.met1();" it should call the method inside the subclass Test39 which is "int met1()" , i think this way because i am creating the object for that particular class which is Test39,
but it gives me an error stating
Test39.java:9: met1() in Test39 cannot override met1() in Temp; attempting to use incompatible return type
found : int
required: void
int met1()
i understand that the
int should be changed to
void to remove this error because i am trying to override the void met() method which is inside the
temp class, but the question still remains in my stupid mind that how does the compiler come to know there are two methods with the same name but with different return types , does it do this checking during compile time ???
sorry guys if this is a stupid question i have no one to ask to so i am asking here and i hope that i can learn
java from this forum and i have joined this forum with that intention in my mind . thanks guys for the support