1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| abstract class FormeGeometrique1
{int x,y;
void deplacer(int x,int y)
{this.x=x;
this.y=y;}
void afficherPosition()
{System.out.println("x="+x+" y="+y);}
abstract double surface();
public static void main(String args[])
{
Rectangle r=new Rectangle(45,12,23,11);
r.afficherPosition();
System.out.println("Surface de rectangle="+r.surface());
carre c1=new carre(15,23,8);
c1.afficherPosition();
System.out.println("Surface de carre="+c1.surface());
System.out.println(c1.toString());
}
} |
Partager