46,241 questions
How to delete a value in array of objects using java

haruman_09
1
Reputation point
I have to add a person's data and delete a person's data using array of objects that will have the output like this:
First Name:
Middle Name:
Last Name:
Press 1 if you want to add a person's data
Press 2 if you want to delete a person's data
then the entered data will be displayed and the user can choose which data they want to delete but i'm still stuck in the part on how to delete a certain data.
package igiveup;
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Employee employee [] = new Employee[3];
for(int i = 0; i < employee.length; i++) {
Scanner s = new Scanner (System.in);
System.out.print("\nFirst Name: ");
String fname = s.nextLine();
System.out.print("Middle Name: ");
String mname = s.nextLine();
System.out.print("Last Name: ");
String lname = s.nextLine();
System.out.print("Job Title: ");
String jobTitle = s.nextLine();
/*System.out.print("Press 1 if you want to add a person");
System.out.print("\nPress 2 if you want to remove a person");
int add = s.nextInt();
int del = s.nextInt();*/
Community Center | Not monitored
Sign in to answer