Exemple #1
0
 public static void main(String[] args) {
   A a = new A();
   B b = new B();
   C c = new C();
   try {
     a.f(3);
     a.f(-3);
   } catch (MyException1 e) {
     System.out.println(e.getMessage());
   }
   try {
     b.f(8, 2);
     b.f(8, 0);
   } catch (MyException2 e) {
     System.out.println(e.getMessage());
   }
   try {
     c.f(3, 4, 5);
     c.f(-1, -4, 0);
   } catch (MyException3 e) {
     System.out.println(e.getMessage());
   }
 }
Exemple #2
0
 public static void main(String[] args) {
   B ref0 = new C();
   A ref1 = ref0;
   ref1.f();
   ref0.f();
 }
 public static void main(String[] args) {
   B b = new A.Inner();
   System.out.println(b.f());
   System.out.println("Done!");
 }