These are all Java Questions. Please only answer if you are sure you answers are
ID: 3697743 • Letter: T
Question
These are all Java Questions. Please only answer if you are sure you answers are correct. Negative reviews will be given if answers are incorrect.
1A.
Which of the following statements about reading web pages is true?
Select one:
a. A Scanner object cannot be used to read a web page.
b. You must create a File object to use with a Scanner object to read a web page.
c. You must create a URL object to use with a Scanner object to read a web page.
d. You must use the openStream() method of a Scanner object to read a web page.
2A.
Your program must read in an existing text file. You want the program to terminate if any exception related to the file occurs. Which of the following indicates the correct code for the main method?
Select one:
a. public static void main(String[] args) throws IOException
b. public static void main(String[] args) throws FileNotFoundException
c. public static void main(String[] args)
d. public static void main(String[] args) throws UnknownFileException
3A.
You have opened a command prompt window and you have entered the following:
Which of the following statements is correct?
Select one:
a. You have supplied one argument value, and this value can be accessed in the main method using the arg1 parameter.
b. You have supplied two argument values, and these values can be accessed in the main method using the arg1 andarg2 parameters.
c. You have supplied one argument value, and this value can be accessed in the main method using the args parameter.
d. You have supplied two argument values, and these values can be accessed in the main method using the argsparameter.
4A.
Consider the following code snippet.
Which of the following statements is correct?
Select one:
a. This code will not open a file named "dataIn.txt", but will treat the string "dataIn.txt" as an input value.
b. This code will create a new file named "dataIn.txt".
c. This code will open an existing file named "dataIn.txt" for reading.
d. This code will open a file named "dataIn.txt" for writing.
5A.
Consider the following code snippet:
Which of the following statements about the PrintWriter object is correct?
Select one:
a. If a file named "output.txt" already exists, an exception will occur.
b. If a file named "output.txt" already exists, data will be added at the end of the file.
c. If a file named "output.txt" already exists, existing data will be deleted before data are added to the file.
d. If a file named "output.txt" already exists, a new file named "output_1.txt" will be created and used.
Explanation / Answer
Hi below i have given the solution but i am not sure about 1A and 4A . Jope this helps you :) Thanks
2A.
Your program must read in an existing text file. You want the program to terminate if any exception related to the file occurs. Which of the following indicates the correct code for the main method?
b. public static void main(String[] args) throws FileNotFoundException
3A.
You have opened a command prompt window and you have entered the following:
Which of the following statements is correct?
d. You have supplied two argument values, and these values can be accessed in the main method using the argsparameter.
5A.
Consider the following code snippet:
Which of the following statements about the PrintWriter object is correct?
c. If a file named "output.txt" already exists, existing data will be deleted before data are added to the file.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.