Question22: You need a container to hold six equal-sized button in the three columns of two. This arrangement must persist when the container is resized. Which of the following will create that container? A. Canvas c=new Canvas(new GridLayout(2,3)); B. Panel p=new Panel(new GridLayout(2,3)); C. Window w=new Window(new GridLayout(2,3)); D. Panel p=new Panel(new GridLayout(3,2)); Obviously, A & D are wrong, since Canvas is not a subclass of container, and D creates a GridLayout with 3 rows, 2 columns. But I don't know what's the difference here between B & C? Why the correct answer is B, not C? Thanks.
Because Window doesn't have a constructor that takes a LayoutManager. ------------------ Tom - SCJP --- Co-Moderator of the Programmer Certification Forums