Using Scanner class in java Program
package array; import java.util.Scanner; public class Scanner_array { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter Your name:"); String name=scanner.nextLine(); System.out.println("Welcome to java "+name); } } ......................................................................... OUTPUT: Enter Your name: Guna Welcome to java Guna

package array;
import java.util.Scanner;
public class Scanner_array {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter Your name:");
String name=scanner.nextLine();
System.out.println("Welcome to java "+name);
}
}
.........................................................................
OUTPUT:
Enter Your name:
Guna
Welcome to java Guna