+ 1
How do I make a Java Input ignore % 's?
Using Scanner in = new Scanner (System.in); int p = in.nextInt(); I want the user to input a % sign but how do I make the Java ignore the percent sign and just get the int data?
2 Réponses
+ 3
the user provides String data, and you have to work out the data in such a way that you can replace String with an int
tip
string.replaceAll("%","");
Integer.parseInt();