Q:

Write a Java Program to Print Simple String entered by user

belongs to collection: Java String Solved Programs

0

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()….

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Java String Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a Java Program to Find Length of String usin... >>