+ 3
10th Nov 2018, 10:01 AM
Леонид Маренков
Леонид Маренков - avatar
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
10th Nov 2018, 2:27 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 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
10th Nov 2018, 10:15 AM
Tashi N
Tashi N - avatar
0
use Dcoder app in astore
10th Nov 2018, 1:15 PM
Mohamed Elbagir Abdalla Doleeb
Mohamed Elbagir Abdalla Doleeb - avatar