Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Java Access Specifier in Overriding

class Animal {
   protected void displayInfo() {
      System.out.println("I am an animal.");
   }
}

class Dog extends Animal {
   public void displayInfo() {
      System.out.println("I am a dog.");
   }
}

class Main {
   public static void main(String[] args) {
      Dog d1 = new Dog();
      d1.displayInfo();
   }
}
Comment

PREVIOUS NEXT
Code Example
Java :: <selector xmlns:android="http://schemas.android.com/apk/res/android<item android;drawable="@drawable/bluebtn" android: state_enabled="false"/ 
Java :: Java Stack class push() method 
Java :: Lists - removing 
Java :: fail method java 
Java :: priority queue is empty java 
Java :: bakht k takht sy yaklakht utara hwa shaks tuny dekha hai kbi jeet k hara hwa shaks in urdu 
Java :: mock a service when the method returning void 
Java :: Removing DOM nodes when traversing a NodeList 
Java :: java set custom property cmd 
Java :: boxing and unboxing in java pdf 
Java :: java pebble replacestart 
Java :: java.lang.StackOverflowError 
Java :: barcode design in postgresql 
Java :: java check if a line is enclosed in quotation marks 
Java :: speak function in java 
Java :: how to set slected row color in javafx tableview 
Java :: how to add a command to a button 
Java :: writing wehere clause in repository in springboot 
Java :: JAVA Print Concatenated Strings 
Java :: java using the segment Information already before the for-loop 
Java :: unmappable character java 
Java :: stop countdown timer when exiting an activity 
Java :: edit activity main drawer items text color android 
Java :: how to make jframe full screen 
Java :: I/System.out: ep: android.os.NetworkOnMainThreadException 
Java :: expandablelistview android 
Java :: Execute method on load 
Java :: random number in java between 10 and 20 
Java :: session-less control using java 
Java :: synchronized method in java 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =