Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Show the difference between this() and super() with help of a code

class Animal {
  void eat() {
    System.out.println("animal : eat");
  }
}

class Dog extends Animal {
  void eat() {
    System.out.println("dog : eat");
  }
  void anotherEat() {
    super.eat();
  }
}

public class Test {
  public static void main(String[] args) {
    Animal a = new Animal();
    a.eat();
    Dog d = new Dog();
    d.eat();
    d.anotherEat();
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: jmonkey shapes 
Java :: print method in java 
Java :: How do I retrieve editors registered for a certain file extension in Eclipse? 
Java :: Algorithms - filtering 
Java :: how to split string with dolor sign in java 
Java :: netbeans how to get string from jcombobox 
Java :: zweidimensionales array erstellen java 
Java :: how to cut a certion part from a string in java 
Java :: more parameters java sql @PathVariable 
Java :: retrofit with api key post 
Java :: Method returns value 
Java :: conexion a mysql java 
Java :: OCA Exam Questions 
Java :: how to make more than one jlabel at once in java 
Java :: extended window style values in java 
Java :: Get and set method uml 
Java :: Period java springboot 
Java :: how to come from 2nd fragment to first fragment android 
Java :: android java shared preferences 
Java :: Spring security avec spring version 2.5.6 
Java :: 13 live 
Java :: The JCheckBox and JComboBox classes belong to which package? 
Java :: check if there is connexion android studio 
Java :: Returning an Array from a Method 
Java :: how to find root viewGroop 
Java :: how to create an indefilite loop in java 
Java :: java lexographic 
Java :: kano magic wand 
Java :: format code netbean 
Java :: how to add a note in java 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =