Question 1 1.5 pts Which of the following statements are TRUE? Check all that ap
ID: 3699550 • Letter: Q
Question
Question 1 1.5 pts Which of the following statements are TRUE? Check all that apply. O A Scanner class can be used to read both interactive user input and files. O In order to create a file object, a programmer must include java.util library To access a file object in Java, you need to create an internal representation of that file using a class called File. When creating a new file object, one should pass a file name. Question 2 1.5 pts Which of the following properly constructs a Scanner object pointing to a file named "myfile.csv"? Check all that apply. O File myfile - new Filel"myile.csv") Scanner in - new Scanner(myfile); Scanner in - new Scanner(new File(myfile.csv); Scanner in - new Scanner(System.in); Scanner in- new Scanner("myfile.csv") Scanner in - new Scanner(new File("myfile.csv"));Explanation / Answer
Question 2)
which of the following properly concstructs a scanner object pointing to a file named "myfile.csv"
Ans) the correct answer is given below
File myfile=new File("myfile.csv");
Scanner in=new Scanner(myfile);
Explanation:
option 1 is correct because we need to create a file first and then we should pass that file name to the scanner object then only a scanner object can be pointed to a file and the remaining options are wrong.
Question 1)
Ans)
a scanner class can be used to read both interactive user inputs and files is True statement
inorder to create a file object , a programmer must include java.util library is False.
to access a file object in java you need to create an internal representation of that file using a class called file is False
when creating a new file object one should pass a file name is True
Hope this Helps, if you have any doubs please comment i will get back to you and please thumbs up, thank you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.