AkhmadGhafirin
5/1/2017 - 10:23 PM

No Such Element

package exception;

import java.util.NoSuchElementException;
import java.util.Scanner;

/**
 * Created by ahmad on 30/04/17.
 */
public class NoSuchElement {
    public NoSuchElement() {
        Scanner input = new Scanner(System.in);
        System.out.print("Masukkan Bilangang : ");
        int x = input.nextInt();
        input.close();
    }

    public static void main(String[] args) {
        NoSuchElement x = new NoSuchElement();
        try {
            NoSuchElement y = new NoSuchElement();
        }catch (NoSuchElementException e){
            System.out.println("NoSuchElementException!");
        }
    }
}