How To Take User Inpu In Java Code Example

Snippet 1

  import java.util.Scanner;
...
  Scanner console = new Scanner(System.in);
  int num = console.nextInt();
  console.nextLine() // to take in the enter after the nextInt() 
  String str = console.nextLine(); 

Snippet 2

  InputUSer Scanner 

Similar Snippets


Creating Java Main Method Code Example – java

Find Duplicates In Arraylist Java Code Example – java

Java Creat A Folder Code Example – java

Firestore Find Doc And Set Data Code Example – java

Create Copy Of Array From Another Array Code Example – java

Copyright © Code Fetcher 2020

 

 

Published

Leave a comment

Your email address will not be published. Required fields are marked *