212k views
3 votes
6.37 LAB*: Program: Authoring assistant(1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt)Ex:Enter a sample text:we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. nothing ends here; our hopes and our journeys continue!You entered: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. nothing ends here; our hopes and our journeys continue!

User Dukethrash
by
6.0k points

1 Answer

0 votes

Answer:

import java.util.Scanner;

public class Lab_Program

{

//declare the variable for scanner

static Scanner in=new Scanner(System.in);

//main method

public static void main(String[] args)

{

//declare the required variable

String str;

//prompt the user to enter a sample text

System.out.println("Enter a sample text: ");

//read the string

str=in.nextLine();

//display the string

System.out.println("You entered: "+str);

}

}

User Jurijs Kovzels
by
6.6k points