Menu
Question Index
...

What will be output of the following program?

import java.util.*;
public class ScannerExample {
    public static void main(String arg[]) {
        String i = "77777";
        Scanner sc = new Scanner(i);
        sc.useDelimiter("");
        while (sc.hasNext()) {
            if (sc.hasNextInt())
                System.out.print(sc.nextInt() + " ~ ");
        }
    }
}


7 ~ 7 ~ 7 ~ 7 ~ 7 ~
77777 ~
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java Scanner Class Methods With Examples

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App