Q&A

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 ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.