salut, je suis débutant en java et j'ai écrit un petit programme et quand je compile il y a des erreurs de compilation.
Pouvez vous m'aider.
Voici ce que le programme doit faire:
Lire 3 nombres entiers et afficher le plus grand .
voici mon code:
Et voila les erreurs de compilation:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 public class exo7 { public static void main (String args []) { System.out.println("Entrer ler entier"); int a=Clavier.lireInt(); System.out.println("Entrer 2ème entier"); int b=Clavier.lireInt(); System.out.println("Entrer 3ème entier"); int c=Clavier.lireInt(); if (a>b) int maxi=a; else int maxi=b; if (c>maxi) int maxi=c; } }
Merci d'avance.----jGRASP exec: javac -g C:\INFORMATIQUE DE GESTION\JAVA\LABO\exo7.java
exo7.java:13: '.class' expected
if (a>b) int maxi=a;
^
exo7.java:13: not a statement
if (a>b) int maxi=a;
^
exo7.java:13: illegal start of expression
if (a>b) int maxi=a;
^
exo7.java:14: 'else' without 'if'
else int maxi=b;
^
exo7.java:15: '.class' expected
if (c>maxi) int maxi=c;
^
exo7.java:15: not a statement
if (c>maxi) int maxi=c;
^
exo7.java:15: illegal start of expression
if (c>maxi) int maxi=c;
^
7 errors
----jGRASP wedge2: exit code for
Partager