Code issue , , , , , , , , , , , , , , , , ,, , , , , , , , , , , , , , , , , , ,

cna you check this why this code not passing all test cases


public static boolean isBalanced(String str, StacksUsingArrays st) throws Exception {
	for(int i=0; i<str.length(); i++)
	{
		if(str.charAt(i)=='('||str.charAt(i)=='{'||str.charAt(i)=='[')
		{
			st.push(str.charAt(i));
		}
		else if(str.charAt(i)==')'||str.charAt(i)=='}'||str.charAt(i)==']')
		{
			if(st.isEmpty())
			{
				return false;
			}
			if(str.charAt(i)=='}')
			{
				if(st.pop()=='{')
				{
					st.pop();
				}
				else
				{
					return false;

				}
			}
			else if(str.charAt(i)==')')
			{
				if(st.pop()=='(')
				{
					st.pop();
				}
				else
				{
					return false;

				}
			}
			else if(str.charAt(i)==']')
			{
				if(st.pop()=='[')
				{
					st.pop();
				}
				else
				{
					return false;
				}
			}
		}
		else
		{
			continue;
		}
	}
	if(st.isEmpty())
	{
        return true;			
	}
	else
	{
		return false;
	}

}

In the second else if part wherein you are checking if the closing braces is the same one as the top of the stack, you are essentially popping the stack two times, which is wrong. First peek to check and if the condition is satisfied, then pop the element.