Java Reference
In-Depth Information
Answers
1. b.
The
PropertyChangeListener
in the
java.beans
package receives a
propertyChange()
event when the worker finishes.
2. b.
The application is described using elements contained within an opening
<information>
tag and a closing
<information>
tag.
3. c.
A Java Web Start application has few restrictions, compared to applets, but they
are limited in some important functionality such as saving files or opening Net
connections. These restrictions will be dropped if a user explicitly grants those
privileges as the application runs.
Certification Practice
The following question is the kind of thing you could expect to be asked on a Java pro-
gramming certification test. Answer it without looking at today's material or using the
Java compiler to test the code.
Given the following,
import java.awt.*;
import javax.swing.*;
public class SliderFrame extends JFrame {
public SliderFrame() {
super();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = getContentPane();
JSlider value = new JSlider(0, 255, 100);
setContentPane(pane);
setSize(325, 150);
setVisible(true);
}
public static void main(String[] arguments) {
new SliderFrame();
}
}
What will happen when you attempt to compile and run this source code?
a.
It compiles without error and runs correctly.
b.
It compiles without error but does not display anything in the frame.
c.
It does not compile because the content pane is empty.
d.
It does not compile because of the new
SliderFrame()
statement.
14