Answers for "simple way to input java"

3

how to use input in java

import java.util.*;
class a 
{
    void main ()
    {
        Scanner in = new Scanner(System.in);
      System.out.print("Please enter you age: ");
      int age = in.nextInt();
      System.out.print("Please enter today's date: ");
      int date = in.nextInt();
      System.out.print("Please enter current month: ");
      int month = in.nextInt();
      System.out.print("Please enter current year: ");
      int year = in.nextInt();
    }
}
// ENJOY!!!!!!!
Posted by: Guest on June-12-2021
7

how to input in java

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();
Posted by: Guest on January-05-2020

Code answers related to "simple way to input java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language