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 |
What is a numeric format?
Write a program to print fibonacci series
What is nested interface?
What are the advantages of java?
perpare on factorypattern,linklist wothout using collection, (multitharding ie create producer/customer therad producer create Queue continuesly,consumer consume queue, consumer wait if queue is full,producer wait if queue is empty),diff betn sleep(1000)&wait(1000) these r the main Q ask in huawei(2008)
What is the simpletimezone class in java programming?
Convert Binary tree to linked list.
When should I use abstract classes and when should I use interfaces?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
What is the use join() in Threads ?
What is finalize method?
Difference between arraylist and vector.