-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Description
我在calculatePostfixValue类中看到的一段
查看来自后端架构师技术图谱 的 栈
//postifx = "1392-*+9+";
char ch=postfix.charAt(i);
if (ch>='0' && ch<='9')
{
result=0;
while (ch!=' ')
{
//将整数字符转为整数值ch=90
result = result*10 + Integer.parseInt(ch+"");
i++;
ch = postfix.charAt(i);
}
i++;
stack.push(result);//操作数入栈
}
这里的Integer.parseInt(ch+"");不会报错?
这里while 里面的ch = postfix.charAt(i);,不是会读取到操作符吗
result*10这个也没明白
Metadata
Metadata
Assignees
Labels
No labels