[ERLEDIGT] Einfacher Rechner funzt nicht
Hi
Ich wollte einfach mal nen kleinen Rechner für 2 additionen porgrammieren
Hier mal der CODE
Fehler:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Cannot make a static reference to the non-static method nextInt() from the type Scanner
Cannot make a static reference to the non-static method nextInt() from the type Scanner
at test.main(test.java:17)
Der Fehler kann doch net so gravierend sein
Hi
Ich wollte einfach mal nen kleinen Rechner für 2 additionen porgrammieren
Hier mal der CODE
Code:
import java.io.*;
import java.util.*;
public class test {
/**
* @param args
*/
public static void main(String[] args) {
int a ,b ,c;
//Ausgabe Hallo
System.out.println("Hallo");
//eingabe a
a = Scanner.nextInt();
//eingabe b
b = scanner.nextInt();
//Berechnung a+b
c = a+b;
System.out.println("Ergebnis" + c );
}
}
Fehler:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Cannot make a static reference to the non-static method nextInt() from the type Scanner
Cannot make a static reference to the non-static method nextInt() from the type Scanner
at test.main(test.java:17)
Der Fehler kann doch net so gravierend sein
Zuletzt bearbeitet: