Profil supprimé | Salut à tous.
J'ai recopié un prog dans un livre pour tester mon prog de dev JAVA, et ca ne marche pas.
J'utilise JCreator LE, et j'ai téléchargé et installé J2SE 5.0.
Mon code est le suivant :
Code :
- import java.io.*;
- class Point // Classe
- {
- private int x, y;
- public Point(int a, int b) // Constructeur
- {
- x = a;
- y = b;
- }
- public void modif(int coeff)
- {
- x = x * coeff;
- y = y * coeff;
- }
- public void affiche_pt()
- {
- System.out.println("coordonnées du point : " + x + " " + y );
- }
- }
- //------------------------------
- class Point_Colore extends Point// Classe
- {
- private String couleur;
- public Point_Colore(int a, int b, String c) // Constructeur
- {
- super(a,b);
- couleur = c;
- }
- public void affiche_pt()
- {
- super.affiche_pt();
- System.out.println("et sa couleur : " + couleur);
- }
- }
- //------------------------------
- class Point_Physique extends Point
- {
- private double poids;
- public Point_Physique(int a, int b, double p)
- {
- super(a,b);
- poids = p;
- }
- public void augmente_poids(double coeff)
- {
- poids = poids * (1 + coeff);
- }
- public void affiche_pt()
- {
- super.affiche_pt();
- System.out.println("et son poids : " + poids);
- }
- }
- //------------------------------
- public class hpoint1
- {
- public static void main(String args[])
- {
- Point pt1 = new Point(-44, 6);
- pt1.affiche_pt();
- pt1.modif(2);
- pt1.affiche_pt();
- Point_Colore ptc = new Point_Colore(2, 6, "bleu" );
- ptc.affiche_pt();
- ptc.modif(3);
- ptc.affiche_pt();
- Point_Physique pphys = new Point_Physique(25, 35, 345);
- pphys.affiche_pt();
- pphys.modif(4);
- pphys.augmente_poids(0.3);
- pphys.affiche_pt();
- }
- }
|
Et voici l'erreur que JCrerator me met lorsque j'execute le prog (Pas d'erreur à la compilation...):
Citation :
The system couldn't find a suitable main method or htm(l) file in the active project."
|
Je vous remercie d'avance de votre aide.
Fred. |