【发布时间】:2014-12-17 14:16:46
【问题描述】:
为什么这小段代码在第 6 行和第 10 行(for 循环)中给出非法类型错误开始...我找不到任何不匹配的大括号...
class StackDemo{
final int size = 10;
Stack s = new Stack(size);
//Push charecters into the stack
for(int i=0; i<size; i++){
s.push((char)'A'+i);
}
//pop the stack untill its empty
for(int i=0; i<size; i++){
System.out.println("Pooped element "+i+" is "+ s.pop());
}
}
我已经实现了 Stack 类,
【问题讨论】:
-
离题,但您应该检查弹出和便便之间的区别。大声笑。
-
我可以删除我自己的问题吗?我犯这个错误的愚蠢程度.....ugghhhhhhhh
-
@m.souvik 你不能。因为这里有答案。下一次之前赶紧问一个问题。请花一些时间自己解决问题。
标签: java compiler-errors stack