Basically i want to confirm that your name that you typed is correct im not really sure what the issue is as im new to java and only started to properly take the time to learn code recently, any suggestions thanks and sorry for the bad code im new to this.
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
public class Username {
@SuppressWarnings({ "unused", "resource" })
public static void main(String[] args) throws InterruptedException {
//This is where you are told to enter your name
@SuppressWarnings({"resource", "unused"})
Scanner sc = new Scanner(System.in);
System.out.println("Enter your name: ");
@SuppressWarnings("resource")
// This is where you enter your name
Scanner scanner = new Scanner(System.in);
// Your name is then saved as a string so it can be called with "name"
String name = scanner.nextLine();
System.out.println("Hello " + name + " lets begin.");
// This is confirming that your name is correct
{
TimeUnit.SECONDS.sleep(2);
System.out.println("For a test your name is " + name + " correct?");
// This is the input for confirming your name
Scanner confirm = new Scanner(System.in);
String confirmation = scanner.nextLine();
boolean istrue = true;
// Meant to print out a line if its = to Yes not working atm
if(istrue = true){
System.out.println("Good lets continue");
}
}
}
}