报错了 ,请教一下怎么改? Operator '!=' cannot be applied to 'java.lang.Object', 'char' 有人会嘛?
```java
public class Exercise05 {
public static void main(String[] args) {
// 3. 括号匹配问题
// 实现judgeBracket(str)方法来判断括号匹配
String str="public class Ex2 { {public static void main(String[] args){}}";
boolean bool=judgeBracket(str);
System.out.println(bool);
}
// 判断括号是否匹配
private static boolean judgeBracket(String str) {
MyArrayStack<Object> stack=new MyArrayStack<>();
for (int i=0; i < str.length(); i++) {
char charAt=str.charAt(i);
if ( charAt=='{' ) {
stack.push('}');
} else if ( charAt=='(' ) {
stack.push(')');
} else if ( charAt=='[' ) {
stack.push(']');
} else if ( charAt==']' || charAt=='}' || charAt==')' ) {
if ( stack.isEmpty() ) return false;
Object pop=stack.pop();
if ( pop !=charAt) return false;
}
}
//
return stack.isEmpty();
}
private static
char getCharAt(char charAt) {
return charAt;
}
}
```