Author of ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- OCPJP Online Training -- Twitter -- How to Ask a Question
Author of ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- OCPJP Online Training -- Twitter -- How to Ask a Question
Tapan Thakkar wrote:code i have used is...
List lst = Collections.EMPTY_LIST;
Collection coll1;
coll = (record from table);
System.out.println(coll1);
//it prints whole on console..
similarly two another Collection coll2,coll3...
it also prints record on console..
bt when i try to append then in a single List or Collection it gives error...n says null pointer exception.......
is there any other way to append list...
Sugita Chaudhary wrote:
Tapan Thakkar wrote:code i have used is...
List lst = Collections.EMPTY_LIST;
Collection coll1;
coll = (record from table);
System.out.println(coll1);
//it prints whole on console..
similarly two another Collection coll2,coll3...
it also prints record on console..
bt when i try to append then in a single List or Collection it gives error...n says null pointer exception.......
is there any other way to append list...
hi Tapan ,
I have tried the below the code and its working absolutely fine
You can also try it in your code :
List<String> l1 = new ArrayList<String>();
l1.add("1");
l1.add("2");
l1.add("3");
List<String> l2 = new ArrayList<String>();
l2.add("4");
l2.add("5");
l2.add("6");
List<String> l3 = new ArrayList<String>();
l3.addAll(l1);
l3.addAll(l2);
System.out.println("Third: " + l3);
Its displaying output " Third: [1, 2, 3, 4, 5, 6] " on the console.
Thanks
hello guys...
i have solved the error...
i have done that using vector..
Tapan Thakkar wrote:List lst = Collections.EMPTY_LIST;
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Consider Paul's rocket mass heater. |