Probleme execution
Fermé
hanachaabani
Messages postés
51
Date d'inscription
mercredi 8 octobre 2014
Statut
Membre
Dernière intervention
14 mars 2016
-
Modifié par KX le 15/11/2014 à 20:15
hanachaabani Messages postés 51 Date d'inscription mercredi 8 octobre 2014 Statut Membre Dernière intervention 14 mars 2016 - 15 nov. 2014 à 20:21
hanachaabani Messages postés 51 Date d'inscription mercredi 8 octobre 2014 Statut Membre Dernière intervention 14 mars 2016 - 15 nov. 2014 à 20:21
A voir également:
- Probleme execution
- Erreur d'execution 1004 - Forum Programmation
- Un administrateur vous a refusé l'execution de cette application - Forum Windows 10
- VBA erreur 1004 ✓ - Forum VB / VBA
- Microsoft a bloqué l'exécution des macros car la source de ce fichier n'est pas approuvée ✓ - Forum Excel
- Erreur d'execution 13 ✓ - Forum Programmation
2 réponses
KX
Messages postés
16668
Date d'inscription
samedi 31 mai 2008
Statut
Modérateur
Dernière intervention
17 mars 2023
3 005
15 nov. 2014 à 20:17
15 nov. 2014 à 20:17
Bonjour,
Quelle est l'erreur, et à quoi ressemble ta classe Point ?
Quelle est l'erreur, et à quoi ressemble ta classe Point ?
hanachaabani
Messages postés
51
Date d'inscription
mercredi 8 octobre 2014
Statut
Membre
Dernière intervention
14 mars 2016
15 nov. 2014 à 20:21
15 nov. 2014 à 20:21
voila la clase point :
package pack2;
import java.util.Scanner;
public class Point
{
private int x ;
private int y ;
private Scanner S ;
public void initialiser (int a , int b)
{
x=a ;
y=b ;
}
public void saisie()
{
S= new Scanner(System.in);
System.out.println("saisir x ");
x=S.nextInt() ;
System.out.println("saisir y ");
y=S.nextInt() ;
}
public void afficher()
{
System.out.println("x : "+x+" y :"+y);
}
public void deplacer(int dx , int dy)
{
x+=dx ;
y+=dy ;
}
public void copier(Point P)
{
x=P.x ;
y=P.y ;
}
public boolean comparer (Point P)
{
return ((x==P.x) && (y==P.y));
}
}
et voila l'erreur qui s'affiche :
donner la taille de tableau
2
saisir x
2
saisir y
5
saisir x
6
saisir y
8
x : 2 y :5
x : 6 y :8
saisir un point
saisir x
2
saisir y
1
point non trouvée
donnez le nombre des points à ajouter
3
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at main2.Exercice2_2.main(Exercice2_2.java:56)
package pack2;
import java.util.Scanner;
public class Point
{
private int x ;
private int y ;
private Scanner S ;
public void initialiser (int a , int b)
{
x=a ;
y=b ;
}
public void saisie()
{
S= new Scanner(System.in);
System.out.println("saisir x ");
x=S.nextInt() ;
System.out.println("saisir y ");
y=S.nextInt() ;
}
public void afficher()
{
System.out.println("x : "+x+" y :"+y);
}
public void deplacer(int dx , int dy)
{
x+=dx ;
y+=dy ;
}
public void copier(Point P)
{
x=P.x ;
y=P.y ;
}
public boolean comparer (Point P)
{
return ((x==P.x) && (y==P.y));
}
}
et voila l'erreur qui s'affiche :
donner la taille de tableau
2
saisir x
2
saisir y
5
saisir x
6
saisir y
8
x : 2 y :5
x : 6 y :8
saisir un point
saisir x
2
saisir y
1
point non trouvée
donnez le nombre des points à ajouter
3
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at main2.Exercice2_2.main(Exercice2_2.java:56)