Advertisement
JeffGrigg

Test201709221246

Sep 22nd, 2017
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.49 KB | None | 0 0
  1. class A {
  2.     public static int add(int a,int b){
  3.         int sum = a+b;
  4.         System.out.println("A.add = " + a+b);
  5.         return sum;
  6.     }
  7. }
  8. class B extends A {
  9.     public static int add(int a, int b) {
  10.         int sum = a + b;
  11.         System.out.println("B.add = " + a + b);
  12.         return sum;
  13.     }
  14. }
  15. public class Test201709221246 {
  16.     public static void main(String[] args) {
  17.         A a = new A();
  18.         A b = new B();
  19.         a.add(2,4);
  20.         b.add(3,5);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement