Q1: | Can a single Java program be both an applet and an application? |
A1:
| It is possible to make a program serve as both applet and application, but it's often an unwieldy solution unless the program is simple. An applet could be set up to run as an application also by including a main() block in the applet, but you would not be able to use the init() block or paint() block in the automatic fashion they are used in an applet. Most programs are written as either an application or as an applet, rather than attempting to do both. |
Q2: | Do all arguments sent to a Java application have to be strings? |
A2:
| Java makes all arguments into strings for storage when an application runs. When you want to use one of these arguments as an integer or some other non-string type, you have to convert the value. You'll learn how to do this during Hour 11, "Describing What Your Object Is Like." |
Q3: | I get errors when I try to load RootApplet.html into either Mozilla Firefox or Microsoft Internet Explorer. What's the problem? |
A3:
| In most cases, the problem is that the browser isn't equipped to run Java 2 applets. Internet Explorer and Firefox lack support for Java 2 applets, which are run by the Java plug-in offered by Sun. When you're in doubt about why an applet won't work in a browser, try loading it with the appletviewer tool included with the Java Development Kit. If it works in appletviewer, the problem is with the browser rather than your Java applet. |
Q4: | Why don't Java applets require the same kind of special access as Common Gateway Interface programs? |
A4:
| Java applets don't have the same access requirements because they don't pose the same risk to a website provider. A Common Gateway Interface (CGI) program is run by the provider's web server.
A web server administrator must trust the people writing gateway programs, because there's no security to prevent the program from harming the server presenting the web page, whether intentionally or by mistake.
Java applets, on the other hand, have strict restrictions to prevent them from being used to write harmful programs. Also, Java programs do not run on a website's server—they run on the computer of the person viewing the page. This also means that the server will not slow down due to numerous people running a Java applet on a page. |
Q5: | In the movie, It's a Wonderful Life, Sam Wainwright cabled Bedford Falls from London authorizing his local office to advance George Bailey up to $25,000 to help him. How much would this money be worth in today's dollars? |
A5:
| Assuming that the scene took place on Christmas Eve 1945, Wainwright's offer was equivalent to $263,000 in current dollars.
More inflation-adjusted figures from the 1946 film: The $8,000 Bailey Building and Loan deposit stolen by Henry Potter is equal to $84,000 today and the $5,000 loan that William Bailey owed Potter in 1919 is like $61,000.
Also in 1919, George Bailey clicked a drugstore lighter and wished for a million dollars. Children today must wish for $12.3 million to be equally enriched.
S. Morgan Friedman offers an inflation calculator on the Web at http://www.westegg.com/inflation. He uses Consumer Price Index statistics from the Historical Statistics of the United States and the Statistical Abstract of the United States. |