Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class easyVector<T> {
- private T[] arr;
- private static int count = 0;
- public static int getCount() {
- return count;
- }
- public easyVector(T[] array) {
- arr = array.clone();
- count++;
- }
- public void print() {
- for (int i = 0; i < arr.length; i++) {
- System.out.print(arr[i] + " ");
- }
- System.out.println();
- }
- }
- public class Main {
- public static Scanner in = new Scanner(System.in);
- public static void main(String[] args) {
- Integer[] I = {11, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- System.out.println(easyVector.getCount());
- easyVector<Integer> a = new easyVector<>(I);
- System.out.println(easyVector.getCount());
- easyVector<Integer> b = new easyVector<>(new Integer[]{1, 6, 2, 7, 3, 5, 8});
- System.out.println(easyVector.getCount());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement