Compiling probem "cannot find symbol"
Hey, I've just started Java.
All the three files are in the same folder, and the two last files were given to me in the exercise, so I'm guessing they're probably right.
I can't figure out why I am getting this error message. I have checked that all the variables are correctly written, and that the file path is right.
Help would be much appreciated.
Code:
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;
}
}
And the two "test programs given to me "
Code:
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);
}
}
Code:
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); } }
And I get the following error message
Code:
thegluups@thegluups-laptop:/media/Hybrid/Documents/Cambridge/ComputerScience/CST1/Java$ javac Tick1/TestBit.java
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