belongs to collection: Java String Solved Programs
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()….
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
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
SOURCE CODE ::
OUTPUT ::
need an explanation for this answer? contact us directly to get an explanation for this answer