Examlex

Solved

Why Doesn't the Following Code Compile Correctly

question 14

Multiple Choice

Why doesn't the following code compile correctly?
Import java.awt.*;
Import java.awt.event.*;
Import javax.swing.*;
Public class ColorCheckBoxWindow extends JFrame
{
Private JCheckBox greenCheckBox;
Private final int WINDOW_WIDTH = 300, WINDOW_HEIGHT = 100;
Public ColorCheckBoxWindow()
{
SetTitle("Green Check Box") ;
SetSize(WINDOW_WIDTH, WINDOW_HEIGHT) ;
SetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ;
GreenCheckBox = new JCheckBox("Green") ;
GreenCheckBox.addItemListener(new CheckBoxListener() ) ;
SetLayout(new FlowLayout() ) ;
Add(greenCheckBox) ;
SetVisible(true) ;
}
Public void itemStateChanged(ItemEvent e)
{
If (e.getSource() == greenCheckBox)
{
System.exit(0) ;
}
}
}


Definitions:

Evgen Bleuler

A Swiss psychiatrist best known for renaming dementia praecox to “schizophrenia,” and for his contributions to the understanding of mental illness.

Sigmund Freud

A pioneering neurologist and the founder of psychoanalysis, known for his theories on the unconscious mind, the development of sexuality, and dream symbolism.

Childlike

Exhibiting qualities traditionally associated with children, such as innocence, naivety, and a sense of wonder.

Disorganized

Describes a lack of structure or order, often leading to difficulty in finding things or focusing on tasks.

Related Questions