Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A {
- public static int add(int a,int b){
- int sum = a+b;
- System.out.println("A.add = " + a+b);
- return sum;
- }
- }
- class B extends A {
- public static int add(int a, int b) {
- int sum = a + b;
- System.out.println("B.add = " + a + b);
- return sum;
- }
- }
- public class Test201709221246 {
- public static void main(String[] args) {
- A a = new A();
- A b = new B();
- a.add(2,4);
- b.add(3,5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement