The Java book I'm using (Java Programming by Joyce Farrel, Thompson Course Technology), when explaining how to add components to an applet, uses the following code:
import javax.swing.*;
import java.awt.*;
public class JHello extends JApplet
{
Container con = getContentPane();
JLabel greeting = new JLabel("Hello. Who are you?");
public void init()
{
con.add(greeting);
}
}
However, it doesn't explain how a Container object can be created without using the keyword new and its constructor. I've looked in three books, several websites, and asked someone for an answer, but I haven't gotten one so far. It's really not impeding my progress through the book; I'm just curious about this.