Skip to content

Instantly share code, notes, and snippets.

@MericBERBER
Last active June 16, 2017 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MericBERBER/a19e85c7b52d023bf404f31826d85b86 to your computer and use it in GitHub Desktop.
Save MericBERBER/a19e85c7b52d023bf404f31826d85b86 to your computer and use it in GitHub Desktop.
// 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