class Point
{
    public Point(char c, double x)
    {  
         nom = c;
         abs = x;
    }
    public void affiche()
    {
        System.out.println("point de nom "  + nom + " d'abscisse " + abs ); // On affiche Nom  
    }
    public void translate (double dx)
    {
        abs += dx;
    }
    private char nom;
    private double abs;
}
public class TstPtAxe
{
    public static void main(String args[]) /* Ceci est la METHODE "main */
    {
        Point a = new Point('C', 2.5); // création d'un objet
        a.affiche();
        Point b = new Point('D', 2.5);
        b.affiche();
        b.translate(2.25);
        b.affiche();
    }
}
			
		
 
	
Partager