Check out example codes for "read int from keyboard java". It will help you in understanding the concepts better.

Code Example 1

import java.util.Scanner;

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

    Scanner scan= new Scanner(;

    //For string

    String text= scan.nextLine();


    //for int

    int num= scan.nextInt();

  /*Is better to create another instance of Scanner if you have to use both nextline 
  	and nextInt because they can conflict each other

Learn ReactJs, React Native from