Java ArrayList Methods Quiz

TrustingPeridot avatar
TrustingPeridot
·
·
Download

Start Quiz

Study Flashcards

Questions and Answers

What package is ArrayList implemented in?

java.util

What is the initial capacity of an empty ArrayList constructed using the default constructor?

10

Which interface does ArrayList provide a dynamic array-like implementation of?

List

What does the method add(E element) do?

<p>Appends the specified element to the end of the list</p> Signup and view all the answers

How is an object created from a class in Java?

<p>Using the keyword new</p> Signup and view all the answers

What is the purpose of creating multiple objects of one class in Java?

<p>To create distinct instances of the class</p> Signup and view all the answers

How can an object of a class be accessed in another class in Java?

<p>By creating an object of the class and accessing it in the other class</p> Signup and view all the answers

What should the name of the Java file match?

<p>The class name</p> Signup and view all the answers

What is the role of a class constructor in Java?

<p>To initialize the object's attributes</p> Signup and view all the answers

What does the keyword 'class' signify in Java?

<p>The beginning of a class definition</p> Signup and view all the answers

Use Quizgecko on...
Browser
Browser