好的,我可以重做一些代码,但是当我尝试编译时,我总是遇到错误。错误:表达式的开始非法(第17行)...箭头指向joption代码的末尾。我不明白它要我做什么。这是代码:

public class Project0 {

public static void main(String[] args) {

    char uppercase = 'E';
    char lowercase = 'e';
    int isLower=0;
    int isUpper =0;
    String inputWord;

inputWord = JOptionPane.showInputDialog(null, "Please enter a sentence");
    while (!inputWord.equals("stop"))
        {
        isLower = wordIsThere(inputWord, lowercase);
        isUpper = wordIsThere(inputWord, uppercase);

      JOptionPane.showMessageDialog(null, ("Number of " +inputWord+ " Lower: " +isLower+ "Upper: " +isUpper+));

      inputWord = JOptionPane.showInputDialog(null, "Please enter a sentence or enter stop");
      isUpper=0;//reset
      isLower=0;
 }//while ends here.

      System.out.println("ENDS");
  }//main
     public static int wordIsThere(String findMe, char theLetter)
  {
    int count=0;
   for (int i=0; i<findMe.length(); i++ )
     if (findMe.charAt(i) == theLetter)
 count++;
        return count;
  }
      }

最佳答案

+方法中删除最后一个showMessageDialog运算符

JOptionPane.showMessageDialog
   (null, ("Number of " +inputWord+ " Lower: " +isLower+ "Upper: " +isUpper));
                                                                           ^

10-04 17:30