Skip to content

Instantly share code, notes, and snippets.

@Caleb2501
Created May 12, 2013 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Caleb2501/5564568 to your computer and use it in GitHub Desktop.
Save Caleb2501/5564568 to your computer and use it in GitHub Desktop.
First Reddit coding challenge completed in Java! exciting! Got the basics through an Udemy course, liking it so far.
// create a program that will ask the users name, age, and reddit username.
// have it tell them the information back, in the format:
// your name is (blank), you are (blank) years old,
// and your username is (blank)
import java.util.Scanner;
public class Challenge1{
public static void main(String[] args){
String name, username;
int userAge;
Scanner input = new Scanner(System.in);
System.out.print("Enter your first and last name please: ");
name = input.nextLine();
System.out.print("Enter your age: ");
userAge = input.nextInt();
System.out.print("Enter your Reddit username: ");
username = input.next();
System.out.println("Your name is " + name + ", you are " +
userAge + "yrs old, and your Reddit username is " +
username + ".");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment