Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- public class StackArray {
- private int size;
- private char[] array;
- private int top;
- public StackArray(int s){//конструктор стека
- size = s;
- array = new char[size];
- top = -1;
- }
- public boolean balance(int a){//самое интересное, проверяем баланс
- StackArray stack = new StackArray(a);
- for (int i = 0; i < a; i++){
- if (MyArray.get(i))
- }
- }
- public static void main(String[] args) {
- Scanner reader = new Scanner(System.in);
- int n = reader.nextInt();
- System.out.println("Количество элементов: " + n);
- ArrayList<Character> myArray = new ArrayList<>(n);
- for (int i = 0; i < n; i++){
- char el = reader.next().charAt(0);
- myArray.add(i, el);
- System.out.print(myArray.get(i) + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement