首页 > 解决方案 > How do I use on method to get the sizes of two different-sized arrayslists?

问题描述

I'm new to Java and I want to use one method, getCount, to get the sizes of two arraylists that are not the same size. What code could I use so that I can call, for example, examp1.getCount and examp2.getCount, and get the two different sizes?

标签: javaarraysarraylist

解决方案


This is frankly as basic a question as it gets, and google could have helped you with this easily. Here's your entire method if you want to design your own.

public static int getCount(ArrayList A){
        return A.size();
    }

推荐阅读