Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Which of the following is the correct syntax for starting a Java program named myProg from a command line if the program requires two

1.

Which of the following is the correct syntax for starting a Java program named myProg from a command line if the program requires two arguments named arg1 and arg2 to be supplied?

Select one:

a. java myProg arg1 arg2

b. java myProg(arg1, arg2)

c. java myProg "arg1" "arg2"

d. java myProg arg1, arg2

2.

If the current method in a program will not be able to handle an exception, what should be coded into the method?

Select one:

a. The throws clause should list the name of the method to which the exception should be passed.

b. The method declaration should be enclosed in a try/catch block.

c. The method should include a try/catch block for all possible exceptions.

d. The throws clause should list the names of all exceptions that the method will not handle.

3.

Consider the following code snippet:

throw new IllegalArgumentException("This operation is not allowed!"); 

Which of the following statements about this code is correct?

Select one:

a. This code constructs an object of type IllegalArgumentException and throws the object.

b. This code throws an existing IllegalArgumentException object.

c. This code constructs an object of type IllegalArgumentException and reserves it for future use.

d. This code will not compile.

4.

Which of the following statements about reading and writing binary data is correct?

Select one:

a. You use the Scanner class to read and write binary data.

b. You use the PrintWriter class to read and write binary data.

c. You use the InputStream class to read binary data and the FileOutputStream class to write binary data.

d. You use the InputStream class to write binary data and the FileOutputStream class to read binary data.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions