Computer Knowledge
Java Core Classes and Threads
1,473 Questions
Java core classes and threads form the foundation of object oriented programming and are crucial for IT officer and programming exams. This includes concepts like string mutability, collections, and multithreading. Solve these questions to test your practical coding and theoretical knowledge.
String and StringBuffer classesThread execution methodsJava collections frameworkCharacter streams input outputVariable serialization rules
Java Core Classes and Threads Questions
-
Adapter classes
-
Inner classes
-
Anonymous classes
-
Window classes
A
Correct answer
Explanation
Java Programming language provide Adapter classes that implement the corresponding listener interface containing more than one method.
-
getConnection()
-
createStatement()
-
executeQuery()
-
getQuery()
A
Correct answer
Explanation
The connection object is initialized using the getConnection() method.
-
translatePoint()
-
getClickCount()
-
isPopupTrigger()
-
getitem()
B
Correct answer
Explanation
getClickCount() method of MouseEvent obtains the number of mouse clicks for the event
-
Event object
-
Event source
-
Event handler
-
None of these
B
Correct answer
Explanation
Event source is an object that generates an event.
-
Java Foundation Class
-
Anonymous Classes
-
Adapter Classes
-
Inner Classes
-
Javax.swing.event
C
Correct answer
Explanation
The java provides Adapter classes that implement the corresponding listener interfaces containing more than one method.
-
Anonymous Classes
-
Java Foundation Classes
-
Inner Classes
-
Adapter Classes
-
Event Object
A
Correct answer
Explanation
Classes that are not named are called anonymous classes and when you declare these classes in a method, don't need a name for these classes.
-
The Window Event Class
-
Javax.swing.event
-
Javax.swing
-
Java Foundation Class
-
The MouseEvent Class
E
Correct answer
Explanation
It defines the integer constants that can be used to identify them and is a subclass of InputEvent class.
-
Java Foundation Class
-
Javax.swing.event
-
Javax.swing
-
The WindowEvent Class
-
Inner Class
D
Correct answer
Explanation
This class defines integer constants that can be used to identify them and this class is a sub class of ComponentEvent class.
-
The FocusEvent Class
-
The InputEvent Class
-
The ItemEvent Class
-
The KeyEvent Class
-
The MouseEvent Class
A
Correct answer
Explanation
This class represents a FocusEvent which is generated when a component gains or loses input focus and this class is a subclass of ComponentEvent class.
-
The MouseEvent Class
-
The TextEvent Class
-
The WindowEvent Class
-
Javax.swing.event
-
Javax.swing
B
Correct answer
Explanation
Instance of this class describe text events which are generated by text fields and text areas when characters are entered by a user or program.
-
The KeyEvent Class
-
The MouseEvent
-
The ItemEvent Class
-
Javax.swing.event
-
Javax.swing
C
Correct answer
Explanation
The ItemEvent Class represents an ItemEvent which is generated when a check box or a list item is clicked or when a checkable menu item is selected or deselected.
-
The ItemEvent Class
-
The KeyEvent Class
-
The MouseEvent Class
-
The InputEvent Class
-
Javax.swing.event
D
Correct answer
Explanation
The abstract class InputEvent is a subclass of ComponentEvent and is the superclass for component input events.
-
The KeyEvent Class
-
The MouseEvent Class
-
The WindowEvent Class
-
Javax.swing.event
-
Java Foundation Class
A
Correct answer
Explanation
Here, a keyEvent is generated when keyboard input occur in the KeyEvent class.
-
DataException
-
XmlException
-
InnerExecption
-
Message
-
Source
C
Correct answer
Explanation
It returns the exception object reference to a nested exception.
-
worker thread
-
UI thread
-
service call
-
foreground process
B
Correct answer
Explanation
In Android, View.post(Runnable) executes the Runnable on the UI thread (main thread). This method is commonly used to update UI elements from background threads, as all UI operations must occur on the UI thread. The posted Runnable executes after the current message queue processing, ensuring thread-safe UI updates.