Write a Java Program to Print Simple String entered by user

By | 09.02.2017

Java Program to Print Simple String entered by user


Java Program to print a string in Java Programming, first you have to ask to the user to enter the string and place that string in any variable say str, and now place this variable str in the bracket of System.out.print()….

SOURCE CODE ::

import java.util.Scanner;

public class print_string
{
   public static void main(String args[])
   {
      String str;
      Scanner scan = new Scanner(System.in);
          
      System.out.print("Enter Your  Name : ");
      str = scan.nextLine();
          
      System.out.print("Hello, " + str);
   }
}

 

OUTPUT ::

 

Enter Your  Name : CodezClub
Hello, CodezClub

 

5 1 vote
Article Rating
Category: Java Programming String Programs Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments