I would like to print a List in Java.
r1
r2
r3
r4
Here is the code:
public static final void main(String args[]) {
Scanner a = new Scanner(System.in);
String r1, r2, r3, r4;
System.out.print("Enter word..");
r1 = a.next();
System.out.print("Enter second word");
r2 = a.next();
System.out.print("Enter third word");
r3 = a.next();
System.out.print("Enter last word");
r4 = a.next();
List list = new List();
list.add(r1);
list.add(r2);
list.add(r3);
list.add(r4);
System.out.println(list);
}
How do I get it print my list rather then:
java.awt.List[list0,0,0,0x0,invalid,selected=null]