Java List size() MethodThe size() method of List Interface returns the total number of elements present in this list. SyntaxParametersNA ReturnThe size() method returns the number of elements in this list. Example 1Test it NowOutput: List : [34, 56, 12, 43] Total element of the list : 4 Example 2Test it NowOutput: Total students : 3 Name : Reema School : Gita Convent School Name : Geetu School : Gita Convent School Name : Saloni School : Eicher School Example 3Test it NowOutput: 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 |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India