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 |
How to pass arraylist to stored procedure in java?
What is the difference between I ++ and ++ I in java?
What is the byte range?
class A { class B { psvm(String args[]) { } } } if the prg saved in A.java whats the o/p?
How to Sort list of Strings in ascending order without using java api.
what is a thread pool in java and why is it used?
How do you declare an array that will hold more than 64KB of data?
How to make object serializable in java?
Can a class have multiple constructors?
If circular link of two objects, then will it be garbage collected ?
Is sizeof a keyword in java programming?
Is ruby built on java?