when you press a "n" the loop terminate.

I think you need this with sentinel value...

[code]

static boolean condition = true;//declare sentinel value
do {

System.out.println("Add more? (y/n)");
Scanner input1=new Scanner(System.in);
String option=input1.next();
if (option.startsWith("y")) {

a.std_details();
list.add(option);
} else if(option.startsWith("n")){
condition=false;// terminate loop
list.add(option);
}
} while (condition);