Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 2.12 KB

README.md

File metadata and controls

55 lines (37 loc) · 2.12 KB

Alice And Bob

Fork this Repository

  • You should work on this project in your own repository.
  • Click the fork button in the top right corner to create a copy of this repository on your github account.
  • You can go through the GitHub forking tutorial if you need additional practice with this.

Alice and Bob Greeting

Objective:

  • Write a program which prompts the user to input his/her name.
  • The program should greet users whose names are 'Alice' and 'Bob'.

Purpose:

  • To establish familiarity with
    • Control Flow
    • Conditionals
    • User input
    • Object instantation/declaration
    • Method invokation

Instructions

  1. Understand how to get input string from user
  2. Create conditional to check against Alice and Bob
  3. Print greeting to screen if Alice or Bob are true
  4. Print "You are neither Alice nor Bob."
  5. When finished, make certain your last commit message is "finished"

Input & Output

Standard input and standard output are important concepts in Java programming.

Standard input is a way for a program to receive input from the user or another program. In Java, standard input is represented by the System.in object. This object can be used with a Scanner object to read input from the user or another program. For example, the following code reads a line of text from the user and stores it in a variable:

Scanner scanner = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = scanner.nextLine();

Standard output is a way for a program to output information to the user or another program. In Java, standard output is represented by the System.out object. This object can be used with the println() method to output text to the console. For example, the following code outputs a greeting to the user:

System.out.println("Hello, " + name + "!");

Standard input and standard output are important concepts in Java programming that allow programs to interact with the user and other programs.

Do the Github thing

When finished, make certain your last commit message is "finished"