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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does index mean in java?

529


How do you pass by reference?

529


What is the purpose of void?

527


What are the two ways to create a thread?

523


Define jit compiler?

648






What is math floor in java?

467


What is the use of put method?

510


When do you get classcastexception?

541


How does list work in java?

498


String class is defined under which package in java?

612


What is the difference between final, finally and finalize()?

535


Will set allow duplicates in java?

494


What method is used to specify a container's layout in java programming?

532


Can we override the static method?

564


Does .length start 0 java?

554