Saturday, January 8, 2022

Input Your Name and Age in Java

 Machine Problem


Write a program that shows basic input and output of user's name and age using

Java programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Program Listing

import java.util.*; public class Input_Name { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("\n"); System.out.println("\tInput Your Name and Age in Java"); System.out.println("\n"); // Input your name System.out.print("\tWhat is your name? "); String name = input.nextLine(); System.out.println("\n"); // Input your age System.out.print("\tHow old are you? "); int age = input.nextInt(); // display output on console System.out.println("\n"); System.out.println("\tHello, " + name + ". Next year, you'll be " + (age + 1) + "."); System.out.println(); System.out.println("\tEnd of Program"); System.out.println(); input.close(); } }

No comments:

Post a Comment