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
Technical questions
Difference between the perimeters of two concentric circles is 66. Find the difference between radius.
a person who decided to go weekend trip should not exceed 8 hours driving in a day average speed of forward journey is 40 mph.due to traffic in sun days the return journey average speed is 30 mph.how far he can select a picnic spot.
If a person walks at 14 km/hr instead of 10 km/hr, he would have walked 20 km more. The actual distance travelled by him is?
Add a word in starting of SCAPE and at the end of Grass, u will get two different word
present ages of sameer and anand are in the ratio of 5 : 4 respectively. Three years hence, the ratio of their ages will become 11 : 9 respectively. What is anand's present age in years?
If the area of a square has increased by 69%,by what % has its side increased?
perimeter of rectangle is s and the other side is x, then the other side
In a 10 digit number, if the 1st digit number is the number of ones,2nd digit number is the number of twos, and ... so on. 10th digit is the number of zeroes,then find the number
Each row of letters or numbers has a rule connecting them. Write the next number or letterin the brackets. 124 , 62 , 60 , 30 , 28 , 14 , (_ _ _)
33 1/3 of 101 + 296 is
slur : speech :: smulge : ?
Find the next letter in the series B,F,J,P ---
pick the odd one out bend shave chop whittle shear
A man drives at a speed of 40 miles/hr. His wife left 30 mins. late with 50 miles/hr speed. when will they meet ?