0% found this document useful (0 votes)
11 views1 page

Simple String Checking Program

The code defines a class with a main method that prompts a user for input, stores it as a variable, calls another method to prompt the user to re-enter the input and compares the two entries to check if they are equal.

Uploaded by

web4ig
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Simple String Checking Program

The code defines a class with a main method that prompts a user for input, stores it as a variable, calls another method to prompt the user to re-enter the input and compares the two entries to check if they are equal.

Uploaded by

web4ig
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

Scanner;

public class Main {

static String Input;

public static void Scan() {


Scanner scanner = new Scanner(System.in);
System.out.println("Type " + Input +" again");
String input = scanner.nextLine();
boolean outcome = input.equals(Input);
System.out.println(outcome);
}

public static void main(String[] args) {


String userInput;
Scanner scanner = new Scanner(System.in);
System.out.println("Type something");
userInput = scanner.nextLine();
Input = userInput;
Scan();
}

You might also like