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


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

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

Read on Facebook