Kann nicht finden das symbol

Ich bin immer der folgende java-compiler-Fehler:

main.java:9: cannot find symbol
symbol  : method parseInt(int)
location: class java.lang.Integer
        int count = Integer.parseInt(getPennies());
                           ^
main.java:23: incompatible types
found   : java.lang.String
required: int
            JOptionPane.showInputDialog("How many pennies do you have?");
                                       ^

2 Fehler

Hier ist mein code

import javax.swing.*;

class main {

public static void main(String args[]) {

    try {

        int count = Integer.parseInt(getPennies());
        System.out.println("You have "+count+" pennies");

    } catch (NumberFormatException exception) {

        System.out.println("Please insert a number");
        getPennies();
    }
}


public static int getPennies() {

    int input = 
            JOptionPane.showInputDialog("How many pennies do you have?");

    return input;
}
}

Jede Idee, warum bin ich immer diese Fehler?

InformationsquelleAutor edwinNosh | 2011-04-01
Schreibe einen Kommentar