Answers for "exit scanner java"

84

java scanner

import java.util.Scanner;

// import scanner 

Scanner myScanner = new Scanner(System.in); // Make scanner obj

String inputString = myScanner.nextLine(); // Take whole line

boolean inputBoolean = myScanner.nextBoolean(); //Boolean input

long inputLong = myScanner.nextLong(); //Interger,long ... input
Posted by: Guest on November-26-2019
3

close scanner java

Scanner scanner = new Scanner("Hello world");

//do something with scanner

scanner.close();
Posted by: Guest on February-23-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language