Explain the inheritance principle.


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More Java Related AllOther Interview Questions

public class Dog { private int weight; public int getweight(){ return weight; } public void SetWeight(int newWeight){ if (newWeight > 0){ weight = newWeight; } } } public class TestDog { public static void main(String[] args) { Dog d = new Dog(); System.out.println("Dog d's weight is " + d.getWeight()); d.setWeight(42); System.out.println("Dog d's weight is " + d.getWeight()); d.setweight(-42); System.out.println("Dog d's weight is " + d.getWeight()); } } class dog is compiled but there is an error in class TestDog when compiled and the error is with dot notations. I want to kmow why there is error in testdog class when compiled.

3 Answers  


what is jdbc?

6 Answers   Cap Gemini,


How to reverse the singly linked list(In Node data members are(int data,int pointerTONext))

0 Answers  


Explain working of java virtual machine (jvm)?

0 Answers  


How do I start netbeans?

0 Answers  






What is difference between loosely coupled and tightly coupled in java?

0 Answers  


What do I need to install netbeans?

0 Answers  


What if I write static public void instead of public static void?

0 Answers  


I run a web server. Am I at risk? : java security

0 Answers  


What is a driver in java?

0 Answers  


Is php faster than java?

0 Answers  


What is aop java?

0 Answers  


Categories