Question: What is printed on each line? public static void main ( String args ) { } scannerTest ( ) ; public static void scannerTest (

What is printed on each line?
public static void main(String args){
}
scannerTest();
public static void scannerTest(){
try {
Scanner scanner = new Scanner(new File("input.txt"));
scanner.next();
System.out.println(scanner.next()); //[line1]
System.out.println(scanner.next()); //[line2]
scanner. next(); scanner. nextline()
System.out.println(scanner.next()); //[line3]
}catch(Exception ex){
}
}
System.out.println("Exception!");
Contents of input.txt
Hello students
CS 1 is pretty cool, difficult, but cool.
100%!
[line1]
[line2]
[line3]
 What is printed on each line? public static void main(String args){

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!