What is wrong in the following program?

```
public class Test {
public static void main (String[] args) {
try {
System.out.println("Welcome to Java");
}
}
}
```
a. You cannot have a try block without a catch block.
b. You cannot have a try block without a catch block or a finally block.
c. A method call that does not declare exceptions cannot be placed inside a try block.
d. Nothing is wrong.


b. You cannot have a try block without a catch block or a finally block.

Computer Science & Information Technology

You might also like to view...

The __________ condition can be prevented by defining a linear ordering of resource types.

A) ?hold and wait ? B) ?no preemption C) ?mutual exclusion ? D) ?circular wait

Computer Science & Information Technology

Physical security includes not only securing the machines but also controlling access to buildings and responding to fires

Indicate whether the statement is true or false.

Computer Science & Information Technology

Mobile apps known as news ________ collect articles from a variety of sources and present them to you in a magazine-style format.

A. aggregators B. blogs C. portals D. servers

Computer Science & Information Technology

Gordon is developing a business continuity plan for a manufacturing company's IT operations. The company is located in North Dakota and currently evaluating the risk of earthquake. They choose to pursue a risk acceptance strategy. Which one of the following actions is consistent with that strategy?

A. Purchasing earthquake insurance B. Relocating the data center to a safer area C. Documenting the decision-making process D. Reengineering the facility to withstand the shock of an earthquake

Computer Science & Information Technology