83
Java List size() Method
The size() method of List Interface returns the total number of elements present in this list.
Syntax
Parameters
NA
Return
The size() method returns the number of elements in this list.
Example 1
Output:
List : [34, 56, 12, 43] Total element of the list : 4
Example 2
Output:
Total students : 3 Name : Reema School : Gita Convent School Name : Geetu School : Gita Convent School Name : Saloni School : Eicher School
Example 3
Output:
Total alphabets : 26 List : [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]
Next TopicJava List