📗 T5 POO Librerías clases fundamentales Flashcards

1
Q

¿Qué es una librería en Java?

A

Un conjunto de código reutilizable que permite a los desarrolladores utilizar funcionalidades sin necesidad de implementarlas desde cero.

Las librerías facilitan el desarrollo al ahorrar tiempo y código.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

¿Cuáles son las dos categorías principales de librerías en Java?

A
  • Librerías para trabajar con arrays y colecciones
  • Librerías para interfaces gráficas de usuario.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

¿Qué es un array en Java?

A

Una estructura de datos que permite guardar uno o más datos dentro de la misma variable.

Los arrays son finitos y su tamaño no puede cambiar una vez declarados.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

¿Qué caracteriza a los arrays en Java?

A

Su tamaño es fijo, no se pueden añadir más elementos de los que inicialmente se declaren.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Menciona dos tipos de colecciones en Java.

A
  • ArrayList
  • HashMap.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

¿Qué son las excepciones en programación?

A

Errores que escapan al control del programador y pueden ocurrir en momentos específicos de la ejecución.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

¿Qué librería se utiliza comúnmente para crear interfaces gráficas en Java?

A

Swing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

¿Cómo se declara un array de enteros en Java?

A

int[] numeros = new int[8];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

¿Cómo se inicializa un array con valores específicos?

A

int[] numeros = new int[]{1,3,67,2,3,6};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

¿Qué valor inicial tendrán todas las posiciones de un array de tipo primitivo en Java?

A

0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

¿Qué se guarda en las posiciones de un array de tipos complejos si no se inicializan?

A

null.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

¿Cómo se accede a un valor específico en un array?

A

Utilizando la sintaxis: array[posición].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

¿Qué propiedad se utiliza para obtener el tamaño de un array?

A

length.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

¿Qué estructura de control se usa comúnmente para recorrer un array?

A

Bucle for.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

¿Cómo se puede recorrer un array sin especificar el inicio y el final?

A

Usando la estructura de control foreach.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

¿Qué tipo de datos puede almacenar un array de tipo Object?

A

Cualquier tipo de dato, ya que Object es la superclase de todos los tipos en Java.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

¿Cuál es la diferencia entre un array y una colección en Java?

A

Los arrays tienen un tamaño fijo, mientras que las colecciones permiten un tamaño dinámico.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

¿Qué se debe hacer para evitar errores de concurrencia al modificar un array?

A

Se recomienda el uso de foreach para recorridos y consultas de datos.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Fill in the blank: Java permite la creación de estructuras de datos que permiten guardar uno o más datos dentro de la misma variable, conocidas como _______.

A

[arrays].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Fill in the blank: Las colecciones en Java permiten _______ y _______ datos de forma dinámica.

A

[añadir], [eliminar].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

¿Qué se almacena en un array de objetos si no se han inicializado?

A

null.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the primary difference between using a traditional for loop and foreach in array modifications?

A

Using foreach avoids concurrency errors when modifying the initial array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

How do you define an array of complex objects in Java?

A

Usuario[] usuarios = new Usuario[]{usuario1, usuario2, usuario3};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What method can be used to access properties of complex object arrays?

A

You can use methods like get() to access properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is the purpose of the break statement in array traversal?

A

To stop the traversal when a specific condition is met.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Fill in the blank: Arrays have a _______ size.

A

finite

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What happens when you try to increase the size of an already defined array?

A

You must clone the array and create a new structure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is the default value of an int array in Java?

A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

How can you initialize an array with random numbers in Java?

A

Use Math.random() to generate random numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What Java method is used to sort an array?

A

Arrays.sort()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What does the method Arrays.copyOf() do?

A

Creates a new array based on an existing array with specified length.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

How can you compare two arrays to see if they are identical?

A

Use Arrays.equals()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

True or False: An array can hold multiple data types.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What is the syntax for creating a multidimensional array in Java?

A

int[][] numeros = new int[numero_filas][numero_columnas];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

How do you access a specific element in a multidimensional array?

A

Use the syntax numerosMulti[fila][columna].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What happens when you initialize a multidimensional array with new int[][]?

A

You create an array of arrays.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

What is the structure of a multidimensional array defined as int[][] numerosMulti = new int[][]{{1,2,3},{4,5,6},{7,8,9}}?

A

It consists of 3 rows and 3 columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

How do you print the value from the first row and second column of a multidimensional array?

A

System.out.println(numerosMulti[0][1]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

What is the purpose of using nested for loops with multidimensional arrays?

A

To traverse through both rows and columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

What is the purpose of the first for loop in the code?

A

To iterate through each row of the multidimensional array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

What does the second for loop do in the context of a multidimensional array?

A

It iterates through each value of the current row

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

In the context of arrays, what is the significance of the variable ‘i’ in the nested for loop?

A

It cannot be reused as a variable in the inner loop since it is already used in the outer loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

What will happen if you try to access an out-of-bounds index in an array?

A

An ArrayIndexException will occur

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

How can you write a value to a specific position in a multidimensional array?

A

By specifying the row and column indices, e.g., numerosMulti[2][1] = 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

Fill in the blank: An array can have multiple dimensions, such as _______.

A

int[][][] numeros3D = new int[3][3][3]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

What are the three main groups of collections in Java?

A
  • Set
  • List
  • Map
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

What is a key characteristic of a Set collection in Java?

A

It does not allow duplicate elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

Name the main implementations of Set in Java.

A
  • HashSet
  • TreeSet
  • LinkedHashSet
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

How do List collections differ from Set collections?

A

Lists allow duplicate elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

What are the main implementations of List in Java?

A
  • ArrayList
  • LinkedList
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

What is the primary function of a Map collection?

A

It stores key-value pairs and does not allow duplicate keys

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

List the main implementations of Map in Java.

A
  • HashMap
  • TreeMap
  • LinkedHashMap
  • HashTable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

What is an ArrayList in Java?

A

A dynamic array that can grow and shrink as elements are added or removed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

How do you declare and initialize an ArrayList in Java?

A

ArrayList listaObjetos = new ArrayList();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

What types of objects can be stored in a typed ArrayList?

A

Only objects of the specified type, e.g., ArrayList<Integer> listaNumeros</Integer>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

What does the add() method do in an ArrayList?

A

It adds an element to the end of the list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

What does the get() method return in an ArrayList?

A

The element at the specified position

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

What happens when you use the remove() method on an ArrayList?

A

It deletes the element at the specified position and shifts subsequent elements left

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

True or False: The contains() method in an ArrayList returns true if an element is present.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

What is a common mistake when accessing elements in an array?

A

Accessing an index that is out of bounds

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

What type of data structure is typically used for grid-like representations, such as a chessboard?

A

Multidimensional arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

What is the initial size of an ArrayList when it is created?

A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

What does the method indexOf() do?

A

Checks the position of a specified element and returns it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q

What is the purpose of the set() method?

A

Modifies the value at the specified position with the indicated value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q

What does the size() method indicate?

A

The number of elements in the list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q

How can all elements in a list be traversed?

A

Using a for loop or a foreach loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q

What is the output of the following code: for (Coche c: listaCoches) { c.motrarDatos(); }?

A

Prints the data of each car in the list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
68
Q

How do you search for elements with at least 130 horsepower?

A

Use a conditional inside a loop to check the horsepower.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
Q

What does a HashMap do?

A

Stores objects of any type associated with an index of a specified type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q

What is the syntax to create a HashMap for cars?

A

HashMap<String, Coche> mapaCoches = new HashMap<>();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
71
Q

What does the put() method do in a HashMap?

A

Adds an element to the HashMap with a specified key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q

What is the purpose of the get() method in a HashMap?

A

Retrieves the element associated with a specified key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q

What does the remove() method do?

A

Deletes the element associated with the specified key.

74
Q

What is returned by containsKey()?

A

A boolean indicating if the specified key exists in the HashMap.

75
Q

What does the replace() method do in a HashMap?

A

Modifies the value of the specified key with a new value.

76
Q

What is the function of the size() method in a HashMap?

A

Indicates the number of elements in the HashMap.

77
Q

What are regular expressions used for?

A

To create search patterns for filtering information.

78
Q

What does the symbol ‘^’ indicate in regular expressions?

A

That the string must start with the specified expression.

79
Q

What does ‘expresión$’ signify in regular expressions?

A

The string must end with the specified expression.

80
Q

What is the purpose of the Pattern class in Java?

A

Represents the regular expression to be compiled.

81
Q

What does the Matcher class do?

A

Compares the regular expression with a string.

82
Q

What is the role of the try/catch/finally block?

A

To handle exceptions and ensure code robustness.

83
Q

What type of error does accessing a null object cause?

A

NullPointerException.

84
Q

What is the effect of using the throw keyword?

A

Explicitly throws an exception.

85
Q

What does the finally block do?

A

Executes code after try/catch, regardless of whether an exception was thrown.

86
Q

Fill in the blank: The method __________ allows you to add an element to a HashMap.

A

put()

87
Q

True or False: A HashMap can contain duplicate keys.

A

False

88
Q

What does the containsValue() method check in a HashMap?

A

Whether a specific value exists in the HashMap.

89
Q

What is the purpose of the ‘finally’ block in exception handling?

A

The ‘finally’ block is executed always, regardless of whether an exception occurred or not.

90
Q

What is the main use of the ‘finally’ block?

A

To close resources that were used in the try block.

91
Q

True or False: The ‘finally’ block is optional in exception handling.

A

True.

92
Q

What is ‘multiple catch’ in exception handling?

A

Capturing more than one type of exception within the same try block.

93
Q

Fill in the blank: A _______ is produced when trying to access an array position that does not exist.

A

ArrayIndexOutOfBoundsException

94
Q

What exception is thrown when attempting to use a method on a null object?

A

NullPointerException

95
Q

What is the result of dividing by zero in Java?

A

ArithmeticException

96
Q

List the main types of exceptions in Java.

A
  • FileNotFoundException
  • ClassNotFoundException
  • EOFException
  • IOException
  • ArrayIndexOutOfBoundsException
  • NullPointerException
  • ArithmeticException
  • Exception
97
Q

What keyword is used to indicate that a method may throw an exception?

A

throws

98
Q

What happens when an exception is caught in a try block?

A

The execution of the try block stops, and the corresponding catch block is executed.

99
Q

What is the consequence of using a generic catch block?

A

You cannot provide detailed error handling for specific exceptions.

100
Q

What is a custom exception in Java?

A

An exception created by the programmer to handle specific error conditions.

101
Q

In the context of exception handling, what does ‘delegation’ mean?

A

Passing the responsibility of handling an exception to the method that calls the current method.

102
Q

True or False: It is good practice to throw exceptions to the main method.

A

False.

103
Q

What message is thrown if the balance is insufficient in a withdrawal method?

A

saldo insuficiente

104
Q

What is the recommended way to handle multiple exceptions?

A

Create a separate catch block for each specific exception type.

105
Q

Fill in the blank: The class that encompasses all types of exceptions is called _______.

A

Exception

106
Q

What is a custom exception in programming?

A

A custom exception is a user-defined error that extends the built-in Exception class.

107
Q

What is the purpose of the class SaldoInsuficiente?

A

To handle insufficient balance errors specifically by creating a custom exception.

108
Q

Which class does SaldoInsuficiente extend?

A

Exception.

109
Q

What does the constructor of SaldoInsuficiente do?

A

It initializes the exception with a message and prints a specific message regarding the insufficient balance.

110
Q

Fill in the blank: To create a custom exception, a class must extend _______.

A

Exception.

111
Q

What method is used to withdraw an amount from an account in the example?

A

retirarSaldo.

112
Q

What happens when saldoSacar is greater than saldo?

A

A SaldoInsuficiente exception is thrown.

113
Q

True or False: The constructor of SaldoInsuficiente takes a single parameter.

A

True.

114
Q

What message is printed when the SaldoInsuficiente exception is created?

A

detectado un fallo de saldo insuficiente.

115
Q

In the method retirarSaldo, what does the ‘throws SaldoInsuficiente’ indicate?

A

It indicates that the method can throw a SaldoInsuficiente exception.

116
Q

What is the output when an insufficient balance error is detected?

A

The message ‘saldo insuficiente’ is passed to the SaldoInsuficiente exception.

117
Q

¿Qué se debe considerar al capturar una excepción en un método?

A

Se debe hacer de la misma forma que se lanza la excepción

Esto implica seguir las prácticas estándar de manejo de excepciones en programación.

118
Q

What is the main focus when creating programs intended for user interaction?

A

Design that is easy to use and intuitive

119
Q

What does GUI stand for?

A

Graphical User Interface

120
Q

How is a GUI defined?

A

A set of techniques that allow communication between two systems or elements

121
Q

According to Biacker and Buxon, how is an interface defined?

A

The set of processes, actions, and dialogues through which a person communicates with a computer

122
Q

What are the three main libraries in Java for creating graphical user interfaces?

A
  • AWT
  • Swing
  • JavaFX
123
Q

What is the primary focus of Swing in Java?

A

Desktop application development

124
Q

What additional capability does JavaFX provide compared to Swing?

A

Embedding applications in a web environment

125
Q

What are the four main groups of elements in Swing?

A
  • Layouts
  • Containers
  • Components
  • Events
126
Q

What is a Layout in Swing?

A

An object that controls the space of a graphical element

127
Q

What is a Container in Swing?

A

Objects that hold elements which users can interact with, such as windows and panels

128
Q

What are Components in Swing?

A

Elements that a GUI can have which the user can see and interact with, like buttons and text fields

129
Q

What are Events in the context of Swing?

A

Actions associated with components when a user interacts with them

130
Q

What is the root element in a Swing interface?

A

JFrame

131
Q

What is the code to create a new JFrame with a title?

A

JFrame ventana = new JFrame(“Titulo”);

132
Q

What method sets the default close operation for a JFrame?

A

setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)

133
Q

What is the purpose of the method setLayout() in a JFrame?

A

To set the layout manager for the JFrame

134
Q

What are the main types of layouts in Swing?

A
  • FlowLayout
  • GridLayout
  • GridBagLayout
  • CardLayout
  • BorderLayout
135
Q

What is the characteristic of FlowLayout?

A

Elements are added from left to right, distributing space between them

136
Q

What does GridLayout require when setting up?

A

The number of rows and columns for element distribution

137
Q

How does BorderLayout organize components?

A

By placing them in predefined positions: north, south, east, west, and center

138
Q

What is the unique feature of CardLayout?

A

Elements are stacked and can be shown or hidden based on references

139
Q

What is the default layout for a JFrame if none is set?

A

BorderLayout

140
Q

What is the method used to add components to a JFrame?

A

add()

141
Q

What is the purpose of creating panels in a Swing application?

A

To configure layouts and organize components effectively

142
Q

What is a typical structure for a data entry form in a GUI?

A
  • Label for name
  • Label for surname
  • Label for phone
  • Add button
  • Clear button
143
Q

What is the code snippet for configuring a JFrame in a class?

A

public class VentenaPrincipal extends JFrame {
public VentenaPrincipal(){
initGUI();
this.setVisible(true);
}
private void initGUI() {
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setTitle(“Formulario contacto”);
this.setSize(400,400);
this.setLayout(new BorderLayout());
}
}

144
Q

What is the purpose of the initGUI() method in the class constructor?

A

Executes all basic window configurations

This method is called before the window is made visible.

145
Q

Why is it important for setVisible() to be the last method called?

A

To avoid displaying the window before it is fully configured, which can lead to errors.

146
Q

What happens after the class is written and an object is created in another class with the main() method?

A

The constructor generates the window.

147
Q

How should components be added if they are basic elements like labels or buttons?

A

They can be added directly in the window class.

148
Q

What should be done if a component needs to be modified later?

A

Declare it as a class variable to elevate its scope.

149
Q

What is the purpose of the configGUI() method in the VentanaPrincipal class?

A

To include all elements in the window.

150
Q

What parameters are required when using the add() method for a JLabel?

A

Component to be added and its location (e.g., NORTH).

151
Q

What layout is used in the PanelCentral class?

A

GridLayout with 3 rows and 1 column.

152
Q

What is the significance of the instancias() method in the PanelCentral class?

A

It initializes the JTextField variables with default values.

153
Q

What does the initConfig() method do in the PanelCentral class?

A

Adds JTextFields to the panel.

154
Q

Fill in the blank: The VentanaPrincipal class extends _______

A

JFrame

155
Q

What happens to the visibility of a JPanel?

A

It does not need to be explicitly set; it will be displayed when added to a window or another panel.

156
Q

What are the three JTextField variables declared in the PanelCentral class?

A
  • textNombre
  • textApellido
  • textTelefono
157
Q

What is the role of the panelCentral variable in the VentanaPrincipal class?

A

It is an instance of the PanelCentral class added to the central part of the window.

158
Q

True or False: The layout for the PanelCentral is set using the GridLayout manager.

A

True

159
Q

What is the purpose of the class PanelInferior?

A

To create a panel that contains two buttons: Aceptar and Limpiar

The class extends JPanel and initializes the buttons in its constructor.

160
Q

What layout is used in the PanelInferior class?

A

FlowLayout

FlowLayout distributes space evenly among all added elements.

161
Q

What does the instancias() method do in the PanelInferior class?

A

It initializes the buttons: botonAceptar and botonLimpiar.

162
Q

Which method adds the buttons to the PanelInferior?

A

configGUI()

163
Q

What is the main purpose of the VentenaPrincipal class?

A

To create the main window of the contact form.

164
Q

What components are added in the configGUI() method of VentenaPrincipal?

A
  • JLabel for title
  • PanelCentral in the center
  • PanelInferior at the bottom
165
Q

What does the initGUI() method configure in the VentenaPrincipal class?

A

Window properties such as location, title, size, and layout.

166
Q

What is an ‘escuchador’ in the context of GUI interfaces?

A

An element that allows a component to listen for specific actions.

167
Q

What are listeners in Swing called?

A

Listeners

168
Q

What is the purpose of the ActionListener?

A

To listen for button clicks.

169
Q

Which method is overridden to define actions for ActionListener?

A

actionPerformed(ActionEvent e)

170
Q

What is the role of the KeyListener?

A

To listen for key press events.

171
Q

List the methods associated with KeyListener.

A
  • keyTyped(KeyEvent e)
  • keyPressed(KeyEvent e)
  • keyReleased(KeyEvent e)
172
Q

What does FocusListener monitor?

A

Focus changes in a component.

173
Q

What methods are associated with FocusListener?

A
  • focusGained(FocusEvent e)
  • focusLost(FocusEvent e)
174
Q

What does MouseListener track?

A

Mouse actions on a component.

175
Q

List the methods associated with MouseListener.

A
  • mouseClicked(MouseEvent e)
  • mousePressed(MouseEvent e)
  • mouseReleased(MouseEvent e)
  • mouseEntered(MouseEvent e)
  • mouseExited(MouseEvent e)
176
Q

What is the purpose of the addActionListener method?

A

To associate an ActionListener with a button.

177
Q

What is the use of KeyAdapter in Java Swing?

A

To simplify the implementation of KeyListener by allowing overriding only necessary methods.

178
Q

True or False: Each component must have a listener to respond to actions.

A

True

179
Q

What happens when a key is pressed in a JTextField with a KeyListener?

A

Three events are generated: keyPressed, keyReleased, keyTyped.

180
Q

What is the significance of modular design in the context of the described interface?

A

It allows separation of components into different classes for better organization.