summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--java.html.markdown8
1 files changed, 6 insertions, 2 deletions
diff --git a/java.html.markdown b/java.html.markdown
index 1f7d4115..56bffd88 100644
--- a/java.html.markdown
+++ b/java.html.markdown
@@ -585,10 +585,14 @@ public interface Edible {
public interface Digestible {
public void digest();
+ // In Java 8, interfaces can have default method.
+ // public void digest() {
+ // System.out.println("digesting ...");
+ // }
}
// We can now create a class that implements both of these interfaces.
-public class Fruit implements Edible, Digestible {
+public class Fruit implements Edible, Digestible {
@Override
public void eat() {
// ...
@@ -636,7 +640,7 @@ public abstract class Animal
// Method can have a body
public void eat()
{
- System.out.println("I am an animal and I am Eating.");
+ System.out.println("I am an animal and I am Eating.");
// Note: We can access private variable here.
age = 30;
}