+ 3
Please help me search my mistake
3 Réponses
+ 13
1)U forgot to write import statement ie,"import java.util.Scanner;"
2)U forgot to put 2 closing brackets
//corrected code ☺
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner register = new Scanner(System.in);
String Name,Lastname,passwor,repeat_password;
System.out.println("Enter your name");
Name=register.nextLine();
System.out.println("Enter your Lastname");
Lastname=register.nextLine();
System.out.println("Enter your password");
passwor=register.nextLine();
System.out.println("Repeat password");
repeat_password=register.nextLine();
int Date_of_birth;
System.out.println("Enter your age");
Date_of_birth=register.nextInt();
if (Date_of_birth >= 18)
System.out.println("You can continue");
else
System.out.println("You're under 18 years old");
if (passwor.equals(repeat_password))
System.out.println("Successful");
else
System.out.println("Password doesn't match");
}
}
//sample input :
mr
xyz
a12
a12
19
+ 10
You mean in the code you published on the playground?
Then you might be confused because of the way inputs are taken... this will help you to understand how the code playground handles inputs:
https://www.sololearn.com/discuss/537451/?ref=app
https://www.sololearn.com/discuss/730932/?ref=app
0
use Dcoder app in astore