Why we declare in the way List ab = new ArrayList(); what is the use of it?
Answer Posted / sravani gupta
When you declare List l = new ArrayList() l is limited to the methods provided by the interface List, while when you declare it ArrayList al = new ArrayList() it can use all methods and fields in an arraylist.
When you declare it List l then you afford yourself more flexibility as you can change out the ArrayList for something more appropriate at a later date if you want to without breaking any code
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
The population of a city increases @ 4% p.a. There is an additional annual increase of 4% of the population due to the influx of job seekers, find the % increase in population after 2 years ?
low temperature at the night in a city is 1/3 more than ½ hinge as higher temperature in a day. sum of the low temp and higherst temp is 100C. then what is the low temperature
A Farmer owns a square land of 15 m each side with a pole in one of the corners to which he tied his cow with a rope whose length is about 10 m. What is the area available for the cow to graze. (Assume pi = 3)
How will u print TATA alone from TATA POWER using string copy and concate commands in C?
2 oranges,3 bananas and 4 apples cost Rs.15 . 3 oranges 2 bananas 1 apple costs Rs 10. what is the cost of 3 oranges, 3 bananas and 3 apples ANs Rs 15.
a number of subsets of a set s is 128, then s has
One person meet his friend on 12:30 then on 1:20 on second day, on third day -----?
One of the longest sides of the triangle is 20 m. The other side is 10 m. Area of the triangle is 80 m2m2. What is the another side of the triangle?
The price of raw materials has gone up by 15%, labour cost has also increased from 25% of the cost of raw material to 30% of the cost of raw material. By how much percentage should there be a reduction in the usage of raw materials so as to keep the cost same
r= 5 n = 3 . If first pole has 2 flags ,third pole has 1 flag how many ways the remaining can be arranged?
In a family Reshma is elder sister of Ragini . Soni is Reshma's daughter and Saloni is Soni's cousin. Rgini's mother is Rajani. Ramani is the sister-inlaw of Reshma. Who is Soni's grandmother?
A Lorry starts from Banglore to Mysore At 6.00 a.m, 7.00 a.m, 8.00 a.m.....10 p.m. Similarly another Lorry on another side starts from Mysore to Banglore at 6.00 a.m, 7.00 a.m, 8.00 a.m.....10.00 p.m. A Lorry takes 9 hours to travel from Banglore to Mysore and vice versa.?
A, B, C, D, E, F, G, H, I are all of squares which are combined in a square. Area of B is 81 cm2. Side of A is 1 cm. Then find area of I?
a man purchased 6 stamps of rupees 1 and seven stamps of 50 paise.he paid Rs. 12. how much change he got back ?
There is a lucky draw held every day. If there is a winning number eg. 1876, then all possible numbers like 1867 ,1687,1768 etc are the numbers that match irrespective of the position of the digits. Thus all these numbers qualify fr the lucky draw prize. Assume there is no zero digit in any numbers. Write a program to show all the possible winning numbers if a "winningnumber" is passed as an argument to the function. i want a solution in c/c++ language