Modify the record provided to have a name (String) and an address (String). Note that the order is important.
Computer scienceProgramming languagesJavaCode organizationObject-oriented programmingClasses and objectsClasses and members
Records
A new record
Report a typo
Sample Input 1:
Diamond
UnknownSample Output 1:
Diamond has the address: UnknownWrite a program in Java 17
import java.util.Scanner;
//modify this Record
record Person() {
}
//don't change the code below
class CheckRecord {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Person person = new Person(scanner.nextLine(), scanner.nextLine());
System.out.println(person.name() + " has the address: " + person.address());
}
}
___
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.