Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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



public class Base { public void myMethod(int a,intb) {} } // Uses myMethod and then hides i..

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

public class Base { public void myMethod(int a,intb) {} } // Uses myMethod and then hides i..

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

Post New Answer

More Core Java Interview Questions

How Array List can be Serialized.

7 Answers   Polaris,


Difference between throw and throws?

0 Answers  


Hi friends am new to java. I read jar file means collection of java files. For executing struts application what are the necessary jar files. " struts.jar " file contains what. can u explain

0 Answers  


waht You know about thread programming?

1 Answers  


why use interface? if interface declear a method implement in class. why direct implement method in class

1 Answers   HCL,






What is meant by event handling?

2 Answers  


Where are register variables stored?

0 Answers  


Why to use nested classes in java?

0 Answers  


Which Math method is used to calculate the absolute value of a number?

3 Answers   Accenture,


What is meant by Encapsulation? Can you write a class to explain encapsulation?

8 Answers   Ness Technologies,


What is Java Reflection API? Why it’s so important to have?

0 Answers  


Differentiate constructor and a method and how are it be used?

7 Answers   Wipro,






Categories