Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Learn Java METHOD OVERRIDING in 4 minutes! ♻️
Play lesson

Java tutorial for beginners ☕ - Learn Java METHOD OVERRIDING in 4 minutes! ♻️

5.0 (4)
40 learners

What you'll learn

This course includes

  • 12 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#java #javatutorial #javacourse public class Main { public static void main(String[] args) { // Method overriding = When a subclass provides its own // implementation of a method that is already defined. // Allows for code reusability and gives specific implementations. Dog dog = new Dog(); Cat cat = new Cat(); Fish fish = new Fish(); dog.move(); cat.move(); fish.move(); } } public class Animal { void move(){ System.out.println("This animal is running"); } } public class Dog extends Animal{ } public class Cat extends Animal{ } public class Fish extends Animal{ @Override void move(){ System.out.println("This animal is swimming"); } }

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere