Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java Overridding example

class Human{
   //Overridden method
   public void eat()
   {
      System.out.println("Human is eating");
   }
}
class Boy extends Human{
   //Overriding method
   public void eat(){
      System.out.println("Boy is eating");
   }
   public static void main( String args[]) {
      Boy obj = new Boy();
      //This will call the child class version of eat()
      obj.eat();
   }
}
Comment

PREVIOUS NEXT
Code Example
Java :: convert array to string in java 
Java :: java sort arraylist of arraylist 
Java :: find last element in array in java 
Java :: java command to start jenkins 
Java :: No suitable driver found for jdbc:mysql 
Java :: java filter array by even numbers 
Java :: get array element java 
Java :: hashmap sort ascending 
Java :: reverse number java 
Java :: elif java 
Java :: list.of java 
Java :: list of string to string array in java 
Java :: get spring application context 
Java :: line break in android xml dynamically 
Java :: how to replace an element in array in java 
Java :: window in java swing 
Java :: jasypt-spring-boot 
Java :: Java The Throw/Throws Keyword 
Java :: write message in file java 
Java :: android navigation drawer open activity 
Java :: spring security logging 
Java :: java equal string 
Java :: color class android 
Java :: constructor 
Java :: android gridview item click effect ripple 
Java :: java spring set private field in test 
Java :: android text change java debounce 
Java :: java code for scientific calculator GUI 
Java :: transparent card background android 
Java :: javafx list view does not update 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =