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 comment