I want to input something like: number23 using JOptionPane, but all I know how to do is either input a number or input a string.
How do I input word + number?
What I have so far:
import javax.swing.JOptionPane;
public class morePractice {
public static void main(String[] args) {
String str;
int num1;
int total=0;
char letter;
str=JOptionPane.showInputDialog(null,"Enter phrase");
for(int i=0;i<str.length();i++){
letter=str.charAt(i);
if(letter>='A'&&letter<='Z'){
total++;
}
}
JOptionPane.showMessageDialog(null,"There are " + total + " upper case letters");
}
}