0
Somebody should check and correct dis code for me ... U keep getting errors🥵💔
import java.util.Scanner; class Program { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); System.out.println("Enter your Age") int = scrn.nextint(); if (age > 15){ System.out.println("Enter your first name"); System.out.println("Enter your last name"); } else { System.out.println("You are underaged"); } String fname = scnr.next(); String lname =scnr.next (); System.out.println("You are welcome" +fname + lname); } }
2 ответов
+ 4
Anumba Chibuike
1 - There is nextInt() not nextint(). I is in caps.
2 - You missed semicolon after first print statement
3 - There is int age = scnr.nextInt(); //you missed age here
4 - there is scnr not scrn (scrn.nextInt() here scrn is wrong)
Here is solution:
---------+-------
import java.util.Scanner;
class Program {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
System.out.println("Enter your Age");
int age = scnr.nextInt();
if (age > 15){
System.out.println("Enter your first name");
System.out.println("Enter your last name");
} else {
System.out.println("You are underaged");
}
String fname = scnr.next();
String lname =scnr.next ();
System.out.println("You are welcome " + fname + " " + lname);
}
}
+ 2
Thank you sir