Guest User

Untitled

a guest
Jul 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 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. String f(C c,C c1){
  15. return "Metodo A c....";
  16. }
  17.  
  18. String f(A a,C a1){
  19. return "metodo A...";
  20. }
  21. String f(A a,B b1){
  22. return "metodo A...";
  23. }
  24. }
  25. class B extends A {
  26. String f (A other, int n) {
  27. return "B1:" + n;
  28. }
  29. String f(){
  30. return "metodo B...";
  31. }
  32. String f(A a,B b1){
  33. return "metodo B...";
  34. }
  35.  
  36. }
  37. class C extends B {
  38. String f (A other, int n) {
  39. return "C1:int " + n;
  40. }
  41.  
  42. String f (B other, long n) {
  43. return "C1:" + n;
  44. }
  45. String f (B other, double n) {
  46. return "C2:" + n;
  47. }
  48. private String f(C other, long n) {
  49. return "C3:" + n;
  50. }
  51. String test1(A a,B b1){
  52. return "metodo C...";
  53. }
  54. String test1(C a,C b){
  55. return "metodo C1...";
  56. }
  57. String f(Object o,Object o1){
  58. return "metodo CO...";
  59. }
  60. }
  61. public class Test1 {
  62. public static void main(String[] args) {
  63. C gamma = new C();
  64. B beta = gamma;
  65. A alfa = gamma;
  66.  
  67. System.out.println(gamma.test1(null,null));
  68. System.out.println(gamma.test1(gamma,gamma));
  69. System.out.println(gamma.f(null,null));
  70. System.out.println(beta.f(alfa,3));
  71. //System.out.println( alfa.f( alfa , 4L));
  72. System.out.println(beta.f(gamma, 4L));
  73. System.out.println(beta.f(beta,3L));
  74. System.out.println(gamma.f(null, 3L));
  75. System.out.println(7 >> 1);
  76. }
  77. }
Add Comment
Please, Sign In to add comment