How to Create Input using JAVA

How to Create Input using JAVA

In this article, you will learn How to Create Input using JAVA. It works like in HTML and PHP

Example:-

import java.util.Scanner; // import the Scanner class 

class MyClass {
  public static void main(String[] args) {
    Scanner myObj = new Scanner(System.in);
    String userName;
     System.out.println("Enter username"); 
    userName = myObj.nextLine();       
    System.out.println("Username is: " + userName);        
  }
}

Read on Facebook