
I want a program by using linked list in java. The data stored must be as Records name age dob Record1 bindu 20 20feb Record2 kavya 21 4mar Record2 sandhya 22 5apr
By using linked list I hve to do that is if user asks record2 that should be display and if user donâ??t want anything it should display null

import java.util.*;
class StudentData
{
String record;
String name;
int age;
String dob;
StudentData(String record, String name, int age,String dob){
this.record=record;
this.name=name;
this.age=age;
this.dob=dob;
}
public String getRecord(){
return record;
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
public String getDob(){
return dob;
}
public static void main(String[] args)
{
LinkedList<StudentData> list=new LinkedList<StudentData>();
list.add(new StudentData("Record1","bindu",20,"20feb"));
list.add(new StudentData("Record2","kavya",21,"4mar"));
list.add(new StudentData("Record3","sandhya",22,"5apr"));
Scanner input=new Scanner(System.in);
System.out.print("Enter record no to display: ");
String rec=input.next();
for(StudentData data:list){
if(data.getRecord().equals(rec)){
System.out.println(data.getRecord()+"\t"+data.getName()+"\t"+data.getAge()+"\t"+data.getDob());
}
}
}
}

if i want to delete data than????
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.