FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 85   



Following program shows you how to scan name of user and say hello with name
In this program we get name from user using scanner method and prints hello with that name using System.out.println()

import java.util.Scanner;

public class Basic3 {

    public static void main(String[] args) {

        System.out.println("Please enter your name:");

        Scanner input = new Scanner(System.in);
        String name = input.next();

        System.out.println("Hello " + name);

    }

}

Output:

Please enter your name:
Tom
Hello Tom



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News