Advertisement
JeffGrigg

Untitled

Dec 8th, 2020
1,991
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.40 KB | None | 0 0
  1. public class Base {
  2.     int id = 1000;
  3.  
  4.     Base() {
  5.         Base();
  6.     }
  7.  
  8.     void Base() {
  9.         System.out.println(++id);
  10.     }
  11. }
  12.  
  13. public class Derived extends Base {
  14.     int id = 2000;
  15.  
  16.     Derived() {}
  17.  
  18.     void Base() {
  19.         System.out.println(--id);
  20.     }
  21. }
  22.  
  23. public class Test {
  24.     public static void main(String[] args) {
  25.         Base base = new Derived();
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement