If statement 三个语法错误,不确定我做错了什么。初学者代码,if-else语句

If statement 三个语法错误,不确定我做错了什么。初学者代码,if-else语句,if-statement,If Statement,我试图编写一个程序,当输入一个句子时,它会给出特定的响应 [[如果句子以问号结尾,且输入包含偶数个字符,则显示“是” 如果句子以问号结尾,并且输入包含奇数个字符,则显示单词No 如果句子以感叹号结尾,则显示单词Wow 在所有其他情况下,显示您经常说的单词,后跟引号内的输入字符串。]] 试着移动我的括号,试着做错误提示的事情,什么都不起作用 ` 发现3个错误: [第31行]错误:语法错误,插入以完成 MethodInvocation[line:31]错误:语法错误,插入;到 complete语句[

我试图编写一个程序,当输入一个句子时,它会给出特定的响应

[[如果句子以问号结尾,且输入包含偶数个字符,则显示“是”

如果句子以问号结尾,并且输入包含奇数个字符,则显示单词No

如果句子以感叹号结尾,则显示单词Wow

在所有其他情况下,显示您经常说的单词,后跟引号内的输入字符串。]]

试着移动我的括号,试着做错误提示的事情,什么都不起作用

`

发现3个错误:

[第31行]错误:语法错误,插入以完成 MethodInvocation[line:31]错误:语法错误,插入;到 complete语句[第31行]错误:语法错误,插入}to 完整块


您需要避开第31行的双引号。工作代码:

import java.util.Scanner;
public class Chapter3ProgrammingProject4_JM
{
public static void main(String[] args)
 {
  Scanner keyboard = new Scanner(System.in);


 System.out.println("Please enter a sentence.");
{
 String word;
 word = keyboard.nextLine();

if ((word.endsWith("?")))
if ((word.length() %2==0))
{
   System.out.println("Yes");

} 

else if ((word.length() %2!=0));

  System.out.println("No");


 if((word.endsWith("!")))

  System.out.println("Wow");

 else 
 System.out.println("You always say " + "\"" + word + "\"");

   }
  }
 }

非常感谢。在我目前的技术水平下,我永远不会明白这一点。
import java.util.Scanner;
public class Chapter3ProgrammingProject4_JM
{
public static void main(String[] args)
 {
  Scanner keyboard = new Scanner(System.in);


 System.out.println("Please enter a sentence.");
{
 String word;
 word = keyboard.nextLine();

if ((word.endsWith("?")))
if ((word.length() %2==0))
{
   System.out.println("Yes");

} 

else if ((word.length() %2!=0));

  System.out.println("No");


 if((word.endsWith("!")))

  System.out.println("Wow");

 else 
 System.out.println("You always say " + "\"" + word + "\"");

   }
  }
 }