Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This method is called to wake up ALL threads waiting for some event. notifyall s

ID: 3858020 • Letter: T

Question

This method is called to wake up ALL threads waiting for some event.

notifyall

synchronized

wait

notify

3 points

Placing this Java reserved word on a method allows us to properly deal with problems that occur when 2 threads simultaneously access a method in an object.

synchronized

transient

volatile

protected

3 points

If an exception is derived from this class, then the compiler won't force you to check for these exceptions.

CheckedException

Throwable

RuntimeException

Exception

3 points

This code could create an output of
23

Set classes don't have Iterators, so this program
will generate an exception when the Iterator is created.

This code could create an output of
233

Because we are working with a Set class, an exception will occur on the second occurrence of:
list.add( new Data(3));

3 points

This class allows you to read objects from an I/O stream. All objects read must implement the Serializable interface.

DataInputStream

BufferedInputStream

Scanner

ObjectInputStream

3 points

Why does it NOT make sense to have an ActionAdapter class?

Because ActionListener serves only as a base interface for the other AWT listener interfaces and should not be implemented directly.

Because the ActionListener interface defines only one method.

Because ActionEvent is a low-level event.

Because ActionListener is rarely used by developers.

3 points

You would call this method inside a synchronized method when you can't progress until something else happens.
By making this call you can suspend execution until the desired operation occurs.

run

wait

sleep

notify

3 points

What is the output of the above program

21

A run time exception will occur during the run of this program

212

The compiler will generate errors on lines 20, 21, 22

3 points

Which line has an error in it (Check all that apply ... there is more than 1 line that needs to be checked)?

Line 10

Line 11

There are no errors

Line 8

Line 7

3 points

The method is called to wake up ONE thread waiting for some event.

start

notify

schedule

run

3 points

Which of the following is true about this program?

It is illegal to create a private class derived from WindowAdapter.

When you click on the "X" box in the upper right corner, the program says Goodbye.

It won't compile because the code doesn't implement the other
WindowListener methods (i.e. WindowOpened, WindowActivated, etc.)

When you click on the "X" box in the upper right corner, the program throws a "Not Implemented" exception because not all WindowListener methods have been implemented.

3 points

This I/O class allows you to write Class Objects to it that implement the Serializable interface.

PrintStream

DataOutputStream

BufferedOutputStream

ObjectOutputStream

3 points

As part of your GUI design, you want to have a dialog that contains 5 buttons arranged vertically. These buttons must take up all of the space provided by the container of the dialog. These buttons are allowed to vary in size but must be the same size as each other no matter how the dialog is resized. What strategy would be the best to use?

null (no Layout Manager). Use Set Bounds to position the buttons in the proper locations.

Create a FlowLayout instance and pass that instance to the setLayout() method of the dialog's container. Then add each of the 5 buttons in turn to that container by calling the add(Component c) method for that container.

Create a GridLayout instance using the constructor GridLayout(5,1) and pass that instance to the setLayout() method of the dialog's container. Then add each of the 5 buttons in turn to that container by calling the add(Component c) method for that container.

Create a BorderLayout instance and pass that instance to the setLayout() method of the dialog's container. Then add each of the 5 buttons in turn to that container by calling the add(Component c) method for that container.

3 points

There is a run time error on which line Number?

Line 10

Line 8

Line 9

Line 7

No Errors

3 points

This class is useful for a Client that wants to connect to a TCP/IP service.

OutputStream

ObjectOutputStream

Connection

Socket

notifyall

synchronized

wait

notify

Explanation / Answer

1) notifyall this method is called to wake up ALL threads waiting for some event.

2)Synchronized Placing this Java reserved word on a method allows us to properly deal with problems that occur when 2 threads simultaneously access a method in an object.

3)Runtime Exception this is the exception where the compiler doesnot care.

20)Scanner -This class allows you to read objects from an I/O stream. All objects read must implement the Serializable interface.

21)Why does it NOT make sense to have an ActionAdapter class? - Because the ActionListener interface defines only one method.

22 You would call this method inside a synchronized method when you can't progress until something else happens.By making this call you can suspend execution until the desired operation occurs. -wait

25)Notify -The method is called to wake up ONE thread waiting for some event.

27)object output stream -his I/O class allows you to write Class Objects to it that implement the Serializable interface.

28)Create a GridLayout instance using the constructor GridLayout(5,1) and pass that instance to the setLayout() method of the dialog's container. Then add each of the 5 buttons in turn to that container by calling the add(Component c) method for that container.

30)Socket helps in helps for the client those who want to connect on the TCP/IP

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote