From 846abc4d9a6764c63fccd245b917b92f71cf00ce Mon Sep 17 00:00:00 2001 From: Kidhanis De Jesus Date: Thu, 8 Jun 2017 13:29:56 -0400 Subject: [en/java] Modify the Animal abstract class (#2751) * Fix word order in class documentation * Change access level modifier of age variable The comment inside eat() mentions that the variable is private. Furthermore, there would be no error if the variable were used inside Dog given the current access level. --- java.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java.html.markdown b/java.html.markdown index 356ca5f1..174177c1 100644 --- a/java.html.markdown +++ b/java.html.markdown @@ -712,8 +712,8 @@ public class ExampleClass extends ExampleClassParent implements InterfaceOne, // must be defined in a child class. Similar to interfaces, abstract classes // cannot be instantiated, but instead must be extended and the abstract // methods defined. Different from interfaces, abstract classes can contain a -// concrete and abstract methods. Methods in an interface cannot have a body, -// mixture of unless the method is static, and variables are final by default, +// mixture of concrete and abstract methods. Methods in an interface cannot +// have a body, unless the method is static, and variables are final by default, // unlike an abstract class. Also abstract classes CAN have the "main" method. public abstract class Animal { @@ -730,7 +730,7 @@ public abstract class Animal // No need to initialize, however in an interface // a variable is implicitly final and hence has // to be initialized. - protected int age; + private int age; public void printAge() { -- cgit v1.2.3