Erro: 'else' sem 'se'
Obtendo uma outra coisa sem declaração:
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 < 20);
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 < 60)
System.out.println ("Golf");
else if (temp < 40)
if (temp >= 20)
System.out.println ("Skiing");
}
}
Eu preciso usar uma cascata se é por isso que parece que. Além disso, você poderia por favor me avise se eu fiz o cascading se corretamente? Eu não fui capaz de encontrar um bom exemplo de cascateamento se assim eu fiz o meu melhor de saber o que significa cascata.
LazyDaysCamp.java:14: error: 'else' without 'if'
else if (temp <= 95)
^
1 error
Esse é o erro que estou recebendo