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

Feb 18, 2025 - 17:47
 0
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