public static void main(String[] args) {
System.out.println("Bitte geben Sie einen Betrag und den Buchstaben der gewunschten Wahrung ein.");
try {
Scanner input = new Scanner(System.in);
double betrag = input.nextInt();
String wahrung = input.next();
double result = 0;
switch(wahrung.charAt(0)) {
case d:
result = betrag * 1.18;
System.out.println(result);
break;
case p:
result = betrag * 0.88;
System.out.println(result);
break;
case f:
result = betrag * 0.88;
System.out.println(result);
break;
}
} catch (Exception e) {
System.out.println("Bitte geben Sie eine Zahl ein.");
}
}
当我尝试编译它时,它说:
Rechner.java:18: error: cannot find symbol
case d:
^
symbol: variable d
location: class Rechner
Rechner.java:22: error: cannot find symbol
case p:
^
symbol: variable p
location: class Rechner
Rechner.java:26: error: cannot find symbol
case f:
^
symbol: variable f
location: class Rechner
答案 0 :(得分:2)
您使用select seq_num,
max(trim(id)) keep (dense_rank first order by trim(id)) as first_id,
max(trim(name)) keep (dense_rank first order by trim(id)) as first_name
from subject
group by seq_num
order by seq_num asc;
切换,因此每个案例也应该是char值。
尝试
char