Advertisement
Virajsinh

Java_06

Feb 7th, 2018
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. //Write A Java Program To Explain Annotation Concept
  2. //1. Override
  3.  
  4. class Animal
  5. {
  6.     void eatSomething()
  7.     {
  8.         System.out.println("Eating Something");
  9.     }
  10. }
  11.     class Dog extends Animal
  12.     {
  13.         @Override
  14.         void eatSomething()
  15.         {
  16.             System.out.println("Eating Foods");
  17.         }
  18.     }
  19.    
  20.         //TestAnnotation
  21.         class Ex6 // This is FileName
  22.         {
  23.             public static void main(String args[])
  24.             {
  25.                 Animal a = new Dog();
  26.                 a.eatSomething();
  27.             }
  28.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement