Chapter Review | Heaton Research

Chapter Review

Get the entire book!
Java for the Beginning Programmer

In this chapter you learned how to read input from the user. All input from the user is read initially as a string. If you need to read data from the user in other formats, you must first read the data as a string, and then convert it to the appropriate type. Java provides many different methods to convert strings into other data types.

You also learned about try/catch blocks. Try/catch blocks are used to handle errors in Java programs. The try block is used to enclose code that you suspect may throw an exception. If an exception is thrown in code that is not inside of a try block, your program will crash. A properly designed program should never crash. If an error is detected by the try block, the program will immediately execute the catch.

Copyright 2005-2008 by Heaton Research, Inc.