
create java program for delete and update the details,without using database, just a normal java program

import java.util.ArrayList;
import java.util.Scanner;
class Person{
String name;
String address;
String email;
Person(String name,String address,String email){
this.name=name;
this.address=address;
this.email=email;
}
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
public void setAddress(String address){
this.address=address;
}
public String getAddress() {
return address;
}
public void setEmail(String email){
this.email=email;
}
public String getEmail() {
return email;
}
}

continue..
public class ArrayListEx{
public static void main(String[] a){
Scanner input=new Scanner(System.in);
ArrayList<Person> list = new ArrayList<Person>();
list.add(new Person("A","Delhi","aa@roseindia.net"));
list.add(new Person("B","Mumbai","bb@roseindia.net"));
list.add(new Person("C","Chennai","cc@roseindia.net"));
list.add(new Person("D","Kolkata","dd@roseindia.net"));
boolean exit=false;
for(Person data: list){
System.out.println(data.getName()+"\t "+data.getAddress()+"\t "+data.getEmail());
}
do{
System.out.println("1 Add Details");
System.out.println("2 Edit Details");
System.out.println("3 Delete Details");
System.out.println("4 Exit");
System.out.print("Enter your choice: ");
int choice=input.nextInt();
switch(choice){
case 1:
System.out.print("Enter name: ");
String name=input.next();
System.out.print("Enter address: ");
String address=input.next();
System.out.print("Enter email: ");
String email=input.next();
list.add(new Person(name,address,email));
for(Person data: list){
System.out.println(data.getName()+"\t "+data.getAddress()+"\t "+data.getEmail());
}
break;
case 2 :
System.out.print("Enter name to edit the details: ");
String nn=input.next();
for(Person data: list){
if(nn.equals(data.getName())){
System.out.print("Enter new name: ");
String newname=input.next();
System.out.print("Enter new address: ");
String newaddress=input.next();
System.out.print("Enter new email: ");
String newemail=input.next();
data.setName(newname);
data.setAddress(newaddress);
data.setEmail(newemail);
}
}
for(Person data: list){
System.out.println(data.getName()+"\t "+data.getAddress()+"\t "+data.getEmail());
}
break;
case 3 :
System.out.print("Enter name to remove the details: ");
String n=input.next();
for(Person data: list){
if(n.equals(data.getName())){
data.setName(" ");
data.setAddress(" ");
data.setEmail(" ");
}
}
for(Person data: list){
System.out.println(data.getName()+"\t "+data.getAddress()+"\t "+data.getEmail());
}
break;
case 4 :
exit=true;
System.exit(0);
break;
default:
System.out.println("Invalid Selection!");
}
}
while(!exit);
}
}

Thanks Thank you very much.......
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.