Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

if you want to compare objects should have something like this, complete answer here here !here !

public boolean equals(Object object2) { return object2 instanceof MyClass && a.equals(((MyClass)object2).a); } 

or could compare for any specific field of its objects for example

if(peopleDirectory.get(i).getFirstName().equals(thePerson.getFirstName())) 

*no need to send a parameter a new Person () could work with a single object class level and only modify their attributes with its setter when you want to perform some operation

nor declare as many Scanner objects if you can work with one for example *

static Scanner userInput = new Scanner(System.in); 

to work with a single object could be something

static Person person = new Person();//declaration 

and its method add or remove when requesting data entry setteas object attributes created and comparison also perform based on that object

System.out.println("Enter the first name of the Person you would like to add: "); person.setFirstName(userInput.nextLine());//data entry and setteo if (peopleDirectory.get(i).equals(person)) // comparation 

if you want to compare objects should have something like this, complete answer here here !

public boolean equals(Object object2) { return object2 instanceof MyClass && a.equals(((MyClass)object2).a); } 

or could compare for any specific field of its objects for example

if(peopleDirectory.get(i).getFirstName().equals(thePerson.getFirstName())) 

*no need to send a parameter a new Person () could work with a single object class level and only modify their attributes with its setter when you want to perform some operation

nor declare as many Scanner objects if you can work with one for example *

static Scanner userInput = new Scanner(System.in); 

to work with a single object could be something

static Person person = new Person();//declaration 

and its method add or remove when requesting data entry setteas object attributes created and comparison also perform based on that object

System.out.println("Enter the first name of the Person you would like to add: "); person.setFirstName(userInput.nextLine());//data entry and setteo if (peopleDirectory.get(i).equals(person)) // comparation 

if you want to compare objects should have something like this, complete answer here here !

public boolean equals(Object object2) { return object2 instanceof MyClass && a.equals(((MyClass)object2).a); } 

or could compare for any specific field of its objects for example

if(peopleDirectory.get(i).getFirstName().equals(thePerson.getFirstName())) 

*no need to send a parameter a new Person () could work with a single object class level and only modify their attributes with its setter when you want to perform some operation

nor declare as many Scanner objects if you can work with one for example *

static Scanner userInput = new Scanner(System.in); 

to work with a single object could be something

static Person person = new Person();//declaration 

and its method add or remove when requesting data entry setteas object attributes created and comparison also perform based on that object

System.out.println("Enter the first name of the Person you would like to add: "); person.setFirstName(userInput.nextLine());//data entry and setteo if (peopleDirectory.get(i).equals(person)) // comparation 
added 484 characters in body
Source Link
Dev. Joel
  • 1.1k
  • 1
  • 9
  • 14

if you want to compare objects should have something like this, complete answer here here !

public boolean equals(Object object2) { return object2 instanceof MyClass && a.equals(((MyClass)object2).a); } 

or could compare for any specific field of its objects for example

if(peopleDirectory.get(i).getFirstName().equals(thePerson.getFirstName())) 

*no need to send a parameter a new Person () could work with a single object class level and only modify their attributes with its setter when you want to perform some operation

nor declare as many Scanner objects if you can work with one for example *

static Scanner userInput = new Scanner(System.in); 

to work with a single object could be something

static Person person = new Person();//declaration 

and its method add or remove when requesting data entry setteas object attributes created and comparison also perform based on that object

System.out.println("Enter the first name of the Person you would like to add: "); person.setFirstName(userInput.nextLine());//data entry and setteo if (peopleDirectory.get(i).equals(person)) // comparation 

if you want to compare objects should have something like this, complete answer here here !

public boolean equals(Object object2) { return object2 instanceof MyClass && a.equals(((MyClass)object2).a); } 

or could compare for any specific field of its objects for example

if(peopleDirectory.get(i).getFirstName().equals(thePerson.getFirstName())) 

*no need to send a parameter a new Person () could work with a single object class level and only modify their attributes with its setter when you want to perform some operation

nor declare as many Scanner objects if you can work with one for example *

static Scanner userInput = new Scanner(System.in); 

if you want to compare objects should have something like this, complete answer here here !

public boolean equals(Object object2) { return object2 instanceof MyClass && a.equals(((MyClass)object2).a); } 

or could compare for any specific field of its objects for example

if(peopleDirectory.get(i).getFirstName().equals(thePerson.getFirstName())) 

*no need to send a parameter a new Person () could work with a single object class level and only modify their attributes with its setter when you want to perform some operation

nor declare as many Scanner objects if you can work with one for example *

static Scanner userInput = new Scanner(System.in); 

to work with a single object could be something

static Person person = new Person();//declaration 

and its method add or remove when requesting data entry setteas object attributes created and comparison also perform based on that object

System.out.println("Enter the first name of the Person you would like to add: "); person.setFirstName(userInput.nextLine());//data entry and setteo if (peopleDirectory.get(i).equals(person)) // comparation 
added 4 characters in body
Source Link
OneCricketeer
  • 193k
  • 20
  • 146
  • 276

if you want to compare objects should have something like this, complete answer here here !

public boolean equals(Object object2) { return object2 instanceof MyClass && a.equals(((MyClass)object2).a); } 

or could compare for any specific field of its objects for example

if(peopleDirectory.get(i).getFirstName().equals(thePerson.getFirstName())) 

*no need to send a parameter a new Person () could work with a single object class level and only modify their attributes with its setter when you want to perform some operation nor

nor declare as many Scanner objects if you can work with one for example *

static Scanner userInput = new Scanner(System.in); 

if you want to compare objects should have something like this, complete answer here here !

public boolean equals(Object object2) { return object2 instanceof MyClass && a.equals(((MyClass)object2).a); } 

or could compare for any specific field of its objects for example

if(peopleDirectory.get(i).getFirstName().equals(thePerson.getFirstName())) 

*no need to send a parameter a new Person () could work with a single object class level and only modify their attributes with its setter when you want to perform some operation nor declare as many Scanner objects if you can work with one for example *

static Scanner userInput = new Scanner(System.in); 

if you want to compare objects should have something like this, complete answer here here !

public boolean equals(Object object2) { return object2 instanceof MyClass && a.equals(((MyClass)object2).a); } 

or could compare for any specific field of its objects for example

if(peopleDirectory.get(i).getFirstName().equals(thePerson.getFirstName())) 

*no need to send a parameter a new Person () could work with a single object class level and only modify their attributes with its setter when you want to perform some operation

nor declare as many Scanner objects if you can work with one for example *

static Scanner userInput = new Scanner(System.in); 
added 145 characters in body
Source Link
Dev. Joel
  • 1.1k
  • 1
  • 9
  • 14
Loading
Source Link
Dev. Joel
  • 1.1k
  • 1
  • 9
  • 14
Loading