Skip to content

Added additional feature to Interface #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ public class InheritanceExamples {
public static void main(String[] args) {
Animal animal = new Cat();
System.out.println(animal.bark());
animal = new Dog();
System.out.println(animal.bark());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.in28minutes.java.oops.interfaces;

interface Flyable {
final int max_altitude=3000; //data members are final in interfaces
void fly();
}

Expand All @@ -20,5 +21,6 @@ public class InterfaceExamples {
public static void main(String[] args) {
Flyable flyable = new Bird();
flyable.fly();
System.out.println(flyable.max_altitude);
}
}