public class Base {
public void myMethod(int a,intb) {}
}
// Uses myMethod and then hides it.
public class DerivedOne extends Base {
private void myMethod(int a,int b);
}
will this compile or not .yes or no. why
Answers were Sorted based on User's Feedback
Answer / ashwin khandelwal
It cannot be compiled because of weaker access privilege give to method in DerivedOne class while overidding method of Base Class
| Is This Answer Correct ? | 12 Yes | 0 No |
Answer / narayana
This will not compile because in the base class myMethod()
function is not having the body ,only abstract methods
should not have the body remaining all methods should have
the body
| Is This Answer Correct ? | 6 Yes | 6 No |
can u handle an error if u write Thowable in the catch class lise try { some errorneous code }catch(Throwable e){ ...}
Which of the classes will have more memory allocated?
Is it possible to instantiate the abstract class?
What is the difference between Array and Hash Table?
Explain parallel processing in java8?
What is illegal identifier in java?
Is null in java?
can we declare private class in java file?
what is difference betweem home interface and remote interface?
Explain 5 io best practices?
How to find the largest value from the given array.
What is parameters example?