|
To access the contents, click the chapter and section titles.
Sams Teach Yourself Visual J++ 6 in 21 Days
SummaryFrame windows are a powerful tool in making programs more flexible and communicative. They can underscore special information you want brought to users attention, or they can hold information thats somehow different than whats in your main program. Theres just about no end to what you can do with Frame windows if you get creative. Go ahead and do the review exercises to really get up to speed! Q&AQ How is a constant variable declared in Java? A A constant variable is declared as a final variable. Q How do you compare two objects for equality? A If the object properly implements the equals() method, the equals() method must be used. The (==) operator can be used, however. This operator only checks to see whether both variables are referencing the same object instance. Q What can you do with a Frame class after you have created it if you have not extended it into your own class? A Not much! You can use a few of the Frame classs methods, such as setTitle() and setSize(), but you wont be able to intercept any kinds of events or override any of the Frame classs methods, such as the paint() method. Q Why is garbage collection in Java so important? A Because the leading causes of program bugs and program failures are memory allocation and overrun bugs. Not having to worry about deallocating memory saves Visual J++ programmers a huge headache. In addition, it prevents many, many bugs from creeping into their programs. Q Why would I ever want to overload methods? Why wouldnt I want to just write separate methods that take different parameters? A The reason is that if methods perform the same functions, they should be named the same thing (for program clarity) even if they do different things. For instance, the concatenate() method does the same thing whether it takes two strings or a string and an integer as arguments. The minute you start renaming these methods depending on which arguments they take, you confuse their meaning and make the program less obvious and less straightforward. Exercises
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |