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 f(C c,C c1){
- return "Metodo A c....";
- }
- String f(A a,C a1){
- return "metodo A...";
- }
- String f(A a,B b1){
- return "metodo A...";
- }
- }
- class B extends A {
- String f (A other, int n) {
- return "B1:" + n;
- }
- String f(){
- return "metodo B...";
- }
- String f(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...";
- }
- String test1(C a,C b){
- return "metodo C1...";
- }
- String f(Object o,Object o1){
- return "metodo CO...";
- }
- }
- public class Test1 {
- public static void main(String[] args) {
- C gamma = new C();
- B beta = gamma;
- A alfa = gamma;
- System.out.println(gamma.test1(null,null));
- System.out.println(gamma.test1(gamma,gamma));
- System.out.println(gamma.f(null,null));
- 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