Print the attributes of the Person record in the following format: "name is age years old and is gender"
Computer scienceProgramming languagesJavaCode organizationObject-oriented programmingClasses and objectsClasses and members
Records
Personal records
Report a typo
Sample Input 1:
Miku 16 femaleSample Output 1:
Miku is 16 years old and is femaleWrite a program in Java 17
import java.util.Scanner;
record Person(String name, int age, String gender) {
//don't change this record
}
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Person person = new Person(scanner.next(), scanner.nextInt(), scanner.next());
// your code goes here
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.