Here you can find the source of confirmAction(String warning)
public static boolean confirmAction(String warning)
//package com.java2s; //License from project: Apache License import java.util.Scanner; public class Main { public static boolean confirmAction(String warning) { System.out.println(warning); System.out.print("Are you sure you want to do this? (yes/no): "); Scanner in = new Scanner(System.in); while (true) { try { String input = in.nextLine(); if ("yes".equals(input)) { return true; } else if ("no".equals(input)) { return false; } else { System.out.println("Please type yes or no"); }/* w w w .j a v a 2s . c om*/ } finally { in.close(); } } } }