Java #6: How To Intake Input in Java

package dagba.computers;
//@author Akinwale Owi

//import the Scanner utility//
import java.util.Scanner;

public class DagbaComputers {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

//Creation of Scanner Object//
Scanner intake = new Scanner (System.in);

//String to save input//
String answer;

//Output question//
System.out.println(“Who’s your favorite arist?”);

//intake question//
answer = intake.nextLine();

//print to check to see if it was saved properly//
System.out.print(“You said you listen to “+answer);

}//End of Main

}//End of Dagba Computers Class

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: