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
*/
}
Also in Java:
- how to read in a file in java
- input java
- processing sound android
- creating thread in java example
- never gonna give you up
- android switch on change
- run static method java
- java int
- strong password regular expression java
- how to open a folder in java swing project
- java override equals and hashcode
- kotlin android intent pass data
- number to string java
- java scanner input int
- java define custom exception
- socket programming in java
- java clear console
- spigot broadcast message
- teimpo en segundos java
- output statement java
- how add strings together
- getordefault java
- how to break two loop in java
- how to check type of primitive value in java