Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package it.compito.otto92009;
- class A {
- String f (A other, int n) {
- return "A1:" + n;
- }
- String f (B other, long n) {
- return "A2:" + n;
- }
- void stampa(){
- }
- String test(A a,A a1){
- return "metodo A...";
- }
- String test1(A a,B b1){
- return "metodo A...";
- }
- }
- class B extends A {
- String f (A other, int n) {
- return "B1:" + n;
- }
- String metodoB(){
- return "metodo B...";
- }
- String test1(A a,B b1){
- return "metodo B...";
- }
- }
- class C extends B {
- String f (A other, int n) {
- return "C1:int " + n;
- }
- String f (B other, long n) {
- return "C1:" + n;
- }
- String f (B other, double n) {
- return "C2:" + n;
- }
- private String f(C other, long n) {
- return "C3:" + n;
- }
- // String test1(A a,B b1){
- // return "metodo C...";
- // }
- }
- public class Test1 {
- public static void main(String[] args) {
- C gamma = new C();
- B beta = gamma;
- A alfa = gamma;
- System.out.println(gamma.test(gamma,gamma));
- System.out.println(gamma.test1(gamma,gamma));
- System.out.println(beta.f(alfa,3));
- //System.out.println( alfa.f( alfa , 4L));
- System.out.println(beta.f(gamma, 4L));
- System.out.println(beta.f(beta,3L));
- System.out.println(gamma.f(null, 3L));
- System.out.println(7 >> 1);
- }
- }
Add Comment
Please, Sign In to add comment