Blog o’ Will Cook for Food
Not just another Wordpress blog

Exercises

2.1

1. A portable program is a program that can be run on a variety of different types of computers without having to change anything.

2. Java’s secure programs and portable nature are two reasons it is better than C++.

3. A thread is a process that can be running while other threads are active, allowing multitasking in programs.

2.2

1. JVM stands for Java Virtual Machine.

2. byte code is the language Java compiles programs into. It is read by the JVM, which acts as an imaginary computer for the purpose of the program.

3. Applets are often shown on websites. these are run by small JVMs incorporated into the web browser, and can be made to do a variety of things, such as display advertisements or interactive site maps.

2.4

1. A program is software that can accomplish a variety of tasks based on its coding and purpose.

2. “println” tells the computer to print whatever is listed after it on the computer screen.

3. “System.out” is used before “println” to define it, and tell the program to display its message in Terminal.

2.5

1. step 1. open notepad and write the program.

step 2. compile the program with the Java compiler “javac myprogram.java”

step 3. run the program with “java myprogram”

2. compile-time errors are errors in the spelling of important details in the code, and keep the Java compiler from compiling the program.

3. a. System.out.println(“Here is an error); this line is missing a ” after the word error.

b.  System.out.println(“Here is another error”; this line is missing closing parentheses after the word error.

4 . Readability helps to allow the user to find errors in the code when revisiting the work, and helps when the user wants to improve the program, it is much easier to do so with readable code.

No Responses Yet to “Exercises”

Leave a Reply