package ru.aserdyuchenko;
/*
Есть массив, из открывающихся и закрывающихся скобок.
Нужно проверить, все ли скобки закрыты.
*/
/**
 * @author Anton Serdyuchenko (anton415@gmail.com)
 * @version $Id$
 * @since 28.11.2016
 */
public class FourthQuestion {
/**
 * @param check - this array is true or false.
 */
private boolean check = false;
/**
 * @param countO - count Open Bracket.
 */
private int countO;
/**
 * @param countC - count Close Bracket.
 */
private int countC;
/**
 * Method for check array.
 * @param array - array for check.
 * @return check - result of check.
 */
	public boolean checkArray(String[] array) {
		for (String index : array) {
			if (index.equals("(")) {
				countO++;
			} else {
				countC++;
			}
			if (countO < countC) {
				check = false;
				break;
			} else if (countO != countC) {
				check = false;
			} else {
				check = true;
			}
		}
	return check;
	}
}

@@ -340,143 +340,8 @@
 /**%0A
- * @param countO - count Open Bracket.%0A */%0Aprivate int countO;%0A/**%0A * @param countC - count Close Bracket.%0A */%0Aprivate int countC;%0A/**%0A
  * M
@@ -483,16 +483,147 @@
 rray) %7B%0A
+/**%0A * @param countO - count Open Bracket.%0A */%0A%09%09int countO = 0;%0A/**%0A * @param countC - count Close Bracket.%0A */%0A%09%09int countC = 0;%0A
 %09%09for (S

Edit FourthQuestion.java. Now count is local.