Guest User

Untitled

a guest
Jul 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. package it.compito.otto92009;
  2.  
  3.  
  4. class A {
  5. String f (A other, int n) {
  6. return "A1:" + n;
  7. }
  8. String f (B other, long n) {
  9. return "A2:" + n;
  10. }
  11. void stampa(){
  12.  
  13. }
  14.  
  15. String test(A a,A a1){
  16. return "metodo A...";
  17. }
  18. String test1(A a,B b1){
  19. return "metodo A...";
  20. }
  21. }
  22. class B extends A {
  23. String f (A other, int n) {
  24. return "B1:" + n;
  25. }
  26. String metodoB(){
  27. return "metodo B...";
  28. }
  29. String test1(A a,B b1){
  30. return "metodo B...";
  31. }
  32.  
  33. }
  34. class C extends B {
  35. String f (A other, int n) {
  36. return "C1:int " + n;
  37. }
  38.  
  39. String f (B other, long n) {
  40. return "C1:" + n;
  41. }
  42. String f (B other, double n) {
  43. return "C2:" + n;
  44. }
  45. private String f(C other, long n) {
  46. return "C3:" + n;
  47. }
  48. // String test1(A a,B b1){
  49. // return "metodo C...";
  50. // }
  51. }
  52. public class Test1 {
  53. public static void main(String[] args) {
  54. C gamma = new C();
  55. B beta = gamma;
  56. A alfa = gamma;
  57.  
  58. System.out.println(gamma.test(gamma,gamma));
  59. System.out.println(gamma.test1(gamma,gamma));
  60. System.out.println(beta.f(alfa,3));
  61. //System.out.println( alfa.f( alfa , 4L));
  62. System.out.println(beta.f(gamma, 4L));
  63. System.out.println(beta.f(beta,3L));
  64. System.out.println(gamma.f(null, 3L));
  65. System.out.println(7 >> 1);
  66. }
  67. }
Add Comment
Please, Sign In to add comment