import java.util.HashMap;
public class Person {
private String surname;
private String name;
public Person(String surname, String name) {
this.name = name;
this.surname = surname;
}
public static void main(String[] args) {
HashMap<Person, String> personMap = new HashMap<>();
Person personi new Person("Smith", "John");
Person person2 new Person("Smith", "John");
=
personMap.put(personi, "personi");
System.out.println(personMap.get(person2));
}
}
what need to be done to see string " person1" as an output?
Answers
Answered by
0
Answer:
Do Java Update and then ask the questions properly
Similar questions