Home > Articles

  • Print
  • + Share This
This chapter is from the book

Certification Practice

The following question is the kind of thing you could expect to be asked on a Java programming certification test. Answer it without looking again at this lesson or using the Java compiler to test the code.


import javax.swing.*;

public class Display extends JFrame {
    public Display() {
        // answer goes here
        JLabel hello = new JLabel("Hello");
        JPanel pane = new JPanel();

    public static void main(String[] arguments) {
        Display ds = new Display();

What statement needs to replace // answer goes here to make the application function properly?

  • A. setSize(300, 200);

  • B. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

  • C. Display ds = new Display();

  • D. No statement is needed.

The answer is available on the book’s website, at www.java21days.com. Visit the Lesson 9 page and click the Certification Practice link.

  • + Share This
  • 🔖 Save To Your Account