Eclips.
import java.util.Scanner;
Public static void Username();{
Scanner Input = new scanner (System.in);
String username
Scanner un = new Scanner(System.in);
System.out.println("Enter Your Username");
username = un.next();
System.out.println("The username you entered is : " + username);}
But if you want to take an integer or double value as input here, how do you do it. I will just give an example of int input, which you just replace int with double.
import java.util.Scanner;
Public static void booksRead();{
Scanner Input = new scanner (System.in);
int books
Scanner br = new Scanner(System.in);
System.out.println("Enter how many books have you read: ");
books = br.next();
System.out.println("The number of books you have read is : " + books);}
source
share