This post has been edited 2 times, last edit by "The-Holy-One" (Jun 13th 2005, 10:06pm)
Guru
Date of registration: Dec 11th 2001
Location: Hämelerwald
Occupation: Wissenschaftlicher Mitarbeiter (Forschungszentrum L3S, TU Braunschweig)
Kann ich mir eigentlich nicht vorstellen.Quoted
Original von Teklan
nee, funktioniert dann auch nicht. Kann es sein, dass ich Java irgendwie "unvollständig" installiert habe und ich die "format".methode wirklich nicht habe? Kann das passieren?
This post has been edited 2 times, last edit by "Joachim" (Jun 13th 2005, 10:42pm)
Quoted
...: cannot find symbol
symbol: method format(double)
location: class java.util.Formatter
Formatter.format ( exp(x))
Guru
Date of registration: Dec 11th 2001
Location: Hämelerwald
Occupation: Wissenschaftlicher Mitarbeiter (Forschungszentrum L3S, TU Braunschweig)
Das ist kein Wunder, die Methode format kann mit einem double-Wert als Parameter auch nichts anfangen. Siehe API-Doc.Quoted
Original von Teklan
import java.util.*;
import static java.lang.Math.*;
formatter.format( exp(5) );
Guru
Date of registration: Dec 11th 2001
Location: Hämelerwald
Occupation: Wissenschaftlicher Mitarbeiter (Forschungszentrum L3S, TU Braunschweig)
Du meinst formatter.format(...).Quoted
Original von Dude
Formatter.format("%1.2f", exp(x));
Quoted
Original von Teklan
hmm, das minimal Programm läuft jetzt, aber bei großen gibts jetzt das da...
ConsoleIODemo.java:78: non-static method format(java.lang.String,java.lang.Object...) cannot be referenced from a static context
Formatter.format("%1.2f", exp(x));
Guru
Date of registration: Dec 11th 2001
Location: Hämelerwald
Occupation: Wissenschaftlicher Mitarbeiter (Forschungszentrum L3S, TU Braunschweig)
Hättest Du in die API-Doc geschaut, wüßtest Du, daß die Klasse Formatter keine statische Methode format besitzt, die Du hier aufzurufen versuchst.Quoted
Original von Teklan
hmm, das minimal Programm läuft jetzt, aber bei großen gibts jetzt das da...
ConsoleIODemo.java:78: non-static method format(java.lang.String,java.lang.Object...) cannot be referenced from a static context
Formatter.format("%1.2f", exp(x));
Guru
Date of registration: Dec 11th 2001
Location: Hämelerwald
Occupation: Wissenschaftlicher Mitarbeiter (Forschungszentrum L3S, TU Braunschweig)
Du kennst den Unterschied zwischenQuoted
Original von Teklan
Liegts vllt doch an der for-schleife? Wird hier irgend etwas statisches erzeugt? a,b,h sind initalisiert.
for ( double x = a; x < b; x = x + h) {
Formatter.format("%1.2f", exp(x));
}
This post has been edited 1 times, last edit by "Joachim" (Jun 13th 2005, 11:18pm)