编译Java找不到符号_Java在编译期间找不到符号

我遇到了问题。我写了一个程序,它允许我计算一个特定的数字,并能够使用前缀和后缀。我需要这个来构建另一个程序。

这是我的代码(// offen是德语for open,// zu for closed)

public class zael{ //offen1

public static void main(String[] args){//offen2

int z = 0;

System.out.println("Bis welche Zahl willst du zaelen?");

String keins = System.console().readLine();

int k = Integer.parseInt(keins);

System.out.println("Willst du einen prefix? (Y/N)");

String p = System.console().readLine();

if (p.equals ("Y")){//offen3

System.out.println("Gib deinen Prefix an!");

String pref = System.console().readLine();

}//zu3

System.out.println("Willst du einen Suffix? (Y/N)");

String s = System.console().readLine();

if (s.equals ("Y")) {//offen4

System.out.println("Gib deinen Suffix an!");

String suff = System.console().readLine();

}//zu4

if (p.equals ("Y")){//offen5

while(z < k) {//offen6

if (s.equals ("Y")) {//offen7

System.out.println(pref);

System.out.print(z+1);

System.out.print(suff);

z = z + 1;

}//zu7

else {//offen8

System.out.println(pref);

System.out.print(z+1);

z = z + 1;

}//zu8

}//zu6

}//zu5

else {//offen9

while (z < k){//offen10

if (s.equals ("Y")) {//offen11

System.out.println("Gib deinen Suffix an!");

String suff = System.console().readLine();

System.out.println(z+1 + suff);

z = z + 1;

}//zu11

else{//offen12

System.out.println(z+1);

z = z + 1;

}//zu12

}//zu10

}//zu9

}//zu2

}//zu1

我得到的错误是:

zael.java:22: error: cannot find symbol

System.out.println(pref);

^

symbol: variable pref

location: class zael

zael.java:24: error: cannot find symbol

System.out.print(suff);

^

symbol: variable suff

location: class zael

zael.java:28: error: cannot find symbol

System.out.println(pref);

^

symbol: variable pref

location: class zael

3 errors

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值