Questions
1. When you compile a Java program, what are you doing?
(a) Saving it to disk
(b) Converting it into a form the computer can better understand
(c) Adding it to your program collection
2. What is a variable?
(a) Something that wobbles but doesn't fall down.
(b) Text in a program that the compiler ignores.
(c) A place to store information in a program.
3. What is the process of fixing errors called?
(a) Defrosting
(b) Debugging
(c) Decomposing
Answers
1. b. Compiling converts a .java file into a .class file or set of .class files.
2. c. Variables are one place to store information; later you'll learn about others such as arrays and constants. Weebles wobble but they don't fall down, and comments are text in a program that the compiler ignores.
3. b. Because errors in a computer program are called bugs, fixing those errors is called debugging. Some programming tools come with a feature called a debugger that helps you fix errors.
Activities
If you'd like to explore the topics covered in this hour a little more fully, try the following activities:
· Write a program for megamillionaires: Calculate the amount the national debt increases in a week.
· Go back to the BigDebt program and add one or two errors. For example, take a semi-colon off the end of a line, or change the line that reads class BigDebt { into class bigDebt {. Save the program and try to compile it. Compare the error messages you get to the errors you caused.
إرسال تعليق