The code is:
JFrame jframe = new JFrame("no difference");
JButton button = new JButton("no difference");
jframe.getContentPane().add(button);
// the same result occurs for
jframe.add(button);
getContentPane
returns a Container
object. What is the point of adding button to the Container if it works equally well with the JFrame? Why bother coding jframe.getContentPane().add(button);
if we can do jframe.add(button);