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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why singleton is not thread safe?

557


What about interthread communication and how it takes place in java?

534


What are the types of java?

596


Why is inheritance used in java?

593


What is break and continue statement?

605






How many types of flags are there?

512


Why are lists ordered in java?

533


What is the difference between multiple processes and multiple threads?

564


Can we use String with switch case?

654


What is a copy constructor in java?

572


Is arraylist ordered?

547


Explain about instanceof operator in java?

594


If a class is declared without any access modifiers, where can the class be accessed?

585


Is integer passed by reference in java?

552


can used Protected Class outside Function.?

602