Last active
June 16, 2017 10:40
-
-
Save MericBERBER/a19e85c7b52d023bf404f31826d85b86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Superclass | |
class Base { | |
// Subclassta saklanacak static metod. | |
public static void display() { | |
System.out.println("Static or class method from Base"); | |
} | |
// Subclassta override edilecek non-static metod. | |
public void print() { | |
System.out.println("Non-static or Instance method from Base"); | |
} | |
} | |
// Subclass | |
class Derived extends Base { | |
// Static burada kaldırıldı. (Compiler Error) | |
public void display() { | |
System.out.println("Non-static method from Derived"); | |
} | |
// Static burada eklendi ( Compiler Error) | |
public static void print() { | |
System.out.println("Static method from Derived"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment