Probleme a la compilation "cannot find symbol"
Bonjour, je viens de debuter avec Java, et j'ai le programme suivant a realiser. Pour le tester, je dois utiliser deux autres programmes que je cite ici aussi.
J'ai bien tout mis dans le meme repertoire, et l'adresse est bien correcte. Mais des que j'essaye de compiler avec javac (en ligne de commande donc) TestBit ou Setbit les deux programmes qui utilisent PackedLong, j'obtiens le message d'erreur suivant :
Code:
1 2 3 4 5 6
| Tick1/TestBit.java:7: cannot find symbol
symbol : variable PackedLong
location: class media.Hybrid.Documents.Cambridge.ComputerScience.CST1.Java.Tick1.TestBit
boolean value = PackedLong.get(currentValue, position);
^
1 error |
Voici mes trois programmes
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| package media.Hybrid.Documents.Cambridge.ComputerScience.CST1.Java.Tick1;
public class PackedLong {
public static boolean get(long packed, int position) {
long check = packed>>position & 1 ;
return (check == 1);
}
public static long set(long packed, int position, boolean value) {
if (value) {
packed = packed - (position<<1) ;
}
else {
packed = packed + (position<<1) ;
}
return packed;
}
} |
et
Code:
1 2 3 4 5 6 7 8 9
| package media.Hybrid.Documents.Cambridge.ComputerScience.CST1.Java.Tick1;
public class SetBit {
public static void main(String [] args) throws Exception {
long currentValue = Long.decode(args[0]);
int position = Integer.parseInt(args[1]);
boolean value = Boolean.parseBoolean(args[2]);
currentValue = PackedLong.set(currentValue,position,value);
System.out.println(currentValue); } } |
et
Code:
1 2 3 4 5 6 7 8 9 10
| package media.Hybrid.Documents.Cambridge.ComputerScience.CST1.Java.Tick1;
public class TestBit {
public static void main(String[] args) throws Exception {
long currentValue = Long.decode(args[0]);
int position = Integer.parseInt(args[1]);
boolean value = PackedLong.get(currentValue, position);
System.out.println(value);
}
} |
Merci d'avance