Here you can find the source of getThreadScanner()
private static Scanner getThreadScanner()
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { private static Map<Long, Scanner> map = new HashMap<>(); private static Scanner getThreadScanner() { long threadId = Thread.currentThread().getId(); Scanner keyboardScanner = map.get(threadId); return keyboardScanner; }/*from w ww . j a v a 2s . c om*/ }