What class allows you to read objects directly from a stream

The ObjectInputStream class supports the reading of objects from input streams. In Core Java, the class that allows you to read objects directly from a stream is ObjectInputStream. This class is part of the Java I/O (Input/Output) API and is used for deserializing objects from a stream. The ObjectInputStream reads data written by an ObjectOutputStream and reconstructs … Read more

What class of exceptions are generated by the Java run-time system?

The Java runtime system generates RuntimeException and Error exceptions. In Java, the exceptions generated by the Java run-time system are primarily categorized into two main types: Checked Exceptions: These are exceptions that the Java compiler forces you to either catch (using a try-catch block) or declare that your method may throw using the throws clause. … Read more

What is the difference between a Choice and a List

A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more … Read more

Name four Container classes.

Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane. In Core Java, container classes typically refer to classes that hold and manage other objects. Here are four container classes in Java: ArrayList: It’s a dynamic array implementation of the List interface, allowing the dynamic resizing of the array as elements are added or removed. java List<String> list = new ArrayList<>(); LinkedList: It’s … Read more

What is the return type of a program’s main() method?

A program’s main() method has a void return type. In Core Java, the return type of a program’s main() method is void. The main() method is the entry point of a Java program, and it is declared with the following signature: java public static void main(String[] args) { // Program logic goes here } The … Read more