If you don't use EXIT_ON_CLOSE, then the frame will probably "disappear" when its close button is clicked, but the Java program will continue to run because System.exit is not called. You will need to kill the program by entering Ctrl+C at the command prompt.
When you specify a larger preferred size for the label, then the JFrame's size will likely increase when pack() is called, which "causes this Window to be sized to fit the preferred size and layouts of its subcomponents."
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Dimensions if i specify as say 5000,5000 at line 14 and at line 15 if i mention as NORTH.
why isnt the TEXT "Prasanna" printed
It is printed - it's just that your frame and label are now so enormous that the text on the label is off the screen.
if i specify Dimensions as 1000,1000 at line 14 and specify NORTH. then why "Prasanna" doesnt come at top left??
There's no other content in the contentPane, so your label in NORTH gets the entire area, the same as if it were in CENTER. BorderLayout only really changes if more than one area of the layout has components in it.
what exactly is a contentpane because i got the same frame after commenting line 13 14 15
This was only added recently - JDK 1.5 or 1.6 - you used to have to call frame.getContentPane().add(...) to add any components to a frame. Now frame.add(...) does the same thing.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.