Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

prendere valore da tastiera java

  import java.util.Scanner;

public class Main{
    public static void main(String args[]){

    Scanner scan= new Scanner(System.in);

    //For string

    String text= scan.nextLine();

    System.out.println(text);

    //for int

    int num= scan.nextInt();

    System.out.println(num);
    }
  /*Is better to create another instance of Scanner if you have to use both nextline 
  	and nextInt because they can conflict each other
  */
  
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #prendere #valore #da #tastiera #java
ADD COMMENT
Topic
Name
3+5 =