import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
var names = Arrays.asList(new String[]{
"Иванов",
});
String[] numbers = {
"79919537683",
};
Scanner scanner = new Scanner(System.in);
System.out.println("Введите фамилию: ");
String name = scanner.next();
if (names.contains(name)) {
System.out.println(numbers[names.indexOf(name)]);
}
scanner.close();
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
var names = Arrays.asList(new String[]{
"Иванов",
});
String[] numbers = {
"79919537683",
};
Scanner scanner = new Scanner(System.in);
System.out.println("Введите фамилию: ");
String name = scanner.next();
if (names.contains(name)) {
System.out.println(numbers[names.indexOf(name)]);
}
scanner.close();
}
}