bonjour,
j'ai 2 packages:
bateau comprenant une class navire
et transport comprenant le main et une classe Transport
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 package bateau; /** * * @author jm18c */ public class navire { public static void affiche(){ System.out.println("ceci est un bateau"); } }
sous netbean cela s'exécute mais en commande en ligne
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 */ package transport; import bateau.*; /** * * @author jm18c */ public class Transport { /** * @param args the command line arguments */ public static void main(String[] args) { navire.affiche(); } }
je compile navire
je compile Transport et là j'ai
je ne comprend pasTransport.java:7: error: package bateau does not exist import bateau.*; ^ Transport.java:18: error: cannot find symbol navire.affiche(); ^ symbol: variable navire location: class Transport 2 errors
merci
Partager