No, an IllegalArgumentException will be thrown if you try to add any type of Window to a Container. You should try to write the code before asking this kind of question, you would have found the answer very quickly. The code is as simple as this:
Never forget that practicing is the key to your success.
Hi sunita, Some more tips.... Basically a container is a component that can accommodate other components and containers. This will provide support for building complex hierarchical GUIs. The abstract class Container has two sub classes 1.Panel and 2.Window. Sub class of panel is Applet and That of Window class is Frame and Dialog. In general there are two types of containers, one can exist by it�s own and the other can not. One can exist by its own is known as a "Top Level Window". Example Window and its sub classes (Frame and Dialog). And for the other type Example is Frame class. A Top Level container (Window) can not be incorporated in to other type of containers (This is the answer to your question!), But it can contain other "non Top Level container", example a frame can contain Panel, but not in the other way!. In that case it will throw an IllegalArgumentException (as Mr.Valentin Crettaz mentioned) Hope this will help you Johnson