错误:'else'没有'if'
没有if语句获取else:import java.util.Scanner;public class LazyDaysCamp{
public static void main (String[] args)
{
int temp;
Scanner scan = new Scanner(System.in);
System.out.println ("What's the current temperature?");
temp = scan.nextInt();
if (temp > 95 || temp
System.out.println ("Visit our shops");
else if (temp <= 95)
if (temp >= 80)
System.out.println ("Swimming");
else if (temp >=60)
if (temp <= 80)
System.out.println ("Tennis");
else if (temp >= 40)
if (temp
System.out.println ("Golf");
else if (temp
if (temp >= 20)
System.out.println ("Skiing");
}}
我需要使用级联,如果它是这样的原因。另外,如果我正确地进行了级联,你能告诉我吗?我无法找到一个很好的级联示例,如果是这样,我只是从知道级联的意义上做到了最好。LazyDaysCamp.java:14: error: 'else' without 'if'
else if (temp <= 95)
^1 error
那是我得到的错误