Find the error in each of the program segments. Explain how to correct the error.

```
void g() {
System.out.println("Inside method g");
void h() {
System.out.println("Inside method h");
}
}
```


Error: Method h is declared within method g.
Correction: Move the declaration of h outside the declaration of g.

Computer Science & Information Technology

You might also like to view...

Assume that inputFile references a Scanner object that was used to open a file. Which of the following while loops is the correct way to read data from the file until the end of the file is reached?

a. while (inputFile.nextLine == " ") { ... } b. while (inputFile != null) { ... } c. while (!inputFile.EOF) { ... } d. while (inputFile.hasNext()) { ... }

Computer Science & Information Technology

Apple uses the name ________ for the IEEE 1394 High Speed Serial Bus port

Fill in the blank(s) with correct word

Computer Science & Information Technology

Two host bits are borrowed if four subnets are to be created. True or False?

Indicate whether the statement is true or false

Computer Science & Information Technology

The _____ displays numbers with a fixed dollar sign to the left of the number, a comma every three positions to the left of the decimal point, and displays numbers to the nearest cent.

A. Comma style format B. Accounting number format C. Percent style format D. Currency style format

Computer Science & Information Technology