Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java virtual override

//Every non-static method in Java is a virtual function except for final and private methods. 
//The methods that cannot be used for the polymorphism is not considered as a virtual function.
//Java does not have a virtual keyword like C++,


class Vehicle{
void make(){
System.out.println("heavy duty");
}
}
public class Trucks extends Vehicle{
void make(){
System.out.println("Transport vehicle for heavy duty");
}
public static void main(String args[]){
Vehicle ob1 = new Trucks();
ob1.make();
}
}

//Output: Transport vehicle for heavy duty

Comment

PREVIOUS NEXT
Code Example
Java :: java gui refresh frame 
Java :: what is the use of the tolowercase in java 
Java :: using handler runnable for refresh android 
Java :: OkHttp3 Never Timeout on slow internet 
Java :: gc algorithms java 8 
Java :: Uri/Beecrowd problem no - 1146 solution in Java 
Java :: javafx change application title 
Java :: @column spring boot jpa 
Java :: Duplicate class android.support.v4.os.ResultReceiver$MyRunnable 
Java :: find minimum of array java 
Java :: java @documented 
Java :: how to search element in sorted array using java 
Java :: console.log in spring boot 
Java :: how to set id to TextView programmatically java android 
Java :: You may test the newly compiled and packaged JAR in maven 
Java :: functionality of predicate functional interface in java 
Java :: spring service discovery 
Java :: android how to get position of a row in listview 
Java :: multipleQuastion.Java 
Java :: spigot item break 
Java :: switch expression 
Java :: java declared fields vs fields 
Java :: Java labeled break Statement 
Java :: how to sort a interable in java 
Java :: serilize filke in java 
Java :: fix intellij resetting the java version everytime you add a dependency 
Java :: trémaux’ method java 
Java :: java create a hashmap 
Java :: single line comment in java 
Java :: Java Generic Functional Interface 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =