Kirky_D
November 13th, 2006, 03:18 PM
Hello all!
I am currently learning java, just started. I have come to formatting the output of a print statement.
This is my code:
public class MathExercise2 {
public static void main(String[] args) {
double speed, distance = 5, time = 3;
speed = distance/time;
System.out.printf("The speed is %4.2f", speed);
}
}
the code compile fine, but it won't run, giving me this error:
Exception in thread "main" java.lang.NoSuchMethodError: method java.io.PrintStream.printf with signature (Ljava.lang.String;[Ljava.lang.Object;)Ljava.io.PrintStream; was not found.
at MathExercise2.main(MathExercise2.java:11)
I think that maybe i have a class library missing. Does anybody know whats going on?
Cheers all!
I am currently learning java, just started. I have come to formatting the output of a print statement.
This is my code:
public class MathExercise2 {
public static void main(String[] args) {
double speed, distance = 5, time = 3;
speed = distance/time;
System.out.printf("The speed is %4.2f", speed);
}
}
the code compile fine, but it won't run, giving me this error:
Exception in thread "main" java.lang.NoSuchMethodError: method java.io.PrintStream.printf with signature (Ljava.lang.String;[Ljava.lang.Object;)Ljava.io.PrintStream; was not found.
at MathExercise2.main(MathExercise2.java:11)
I think that maybe i have a class library missing. Does anybody know whats going on?
Cheers all!