Arfizato

exercice 3

Jan 10th, 2022
885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. class Exercice3{
  2.     public static void main(String[] args) {
  3.         A x = new A();
  4.         B y = new B();
  5.         C z = new C();
  6.         y.b = 2;
  7.         z.c = 3;
  8.     }
  9.     abstract class  A{
  10.         int a;
  11.     }
  12.     class  B extends A{
  13.         int b;
  14.         public B(int b){
  15.             this.b= b;
  16.         }
  17.     }
  18.     class C extends A {
  19.         final double c = 1;
  20.     }
  21.  
  22.     abstract class D extends  A{
  23.         double d;
  24.         int operation(int a){
  25.             return (a*2);
  26.         }
  27.         abstract int calcul(int b){
  28.  
  29.         }
  30.         abstract void afficher();
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment