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


Please Help Members By Posting Answers For Below Questions

If r = 5, n=3 and if first pole has 2 flags, third pole has 1 flag, how many ways can the flags be arranged?

681


If A=Z, B=Y, C=X, .......... Z=A, Then SOUR = ?

660


5) DB2 maintains information about the data a) In Tables b) In a set of tables known as DB2 catalog c) In DB2 database d) None of the above

1755


Hansie made the following amounts in seven games of cricket in India: Rs.10, Rs.15, Rs.21, Rs.12, Rs.18, Rs.19 and Rs.17(all figures in crores of course).Find his average earnings.

885


Four Members A, B, C, D are playing a game .A person losing a game should double the amount of others .B, C, D are losing in order after three games .The amount after 3 games are A&B having 40,D is having 16&C 80. Who started with greatest amount of money?

772






Can you tender a one rupee note in such a manner that there shall be total 50 coins but none of them would be 2 paise coins.?

930


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

1952


A car travels 12 kms with a 4/5th filled tank.How far will the car travel with 1/3 filled tank?

997


If PQRST is a paralellogram .What is the ratio triangle PQS & PQRST.

713


Let's say that you have 25 horses, and you want to pick the fastest 3 horses out of those 25. In each race, only 5 horses can run at the same time because there are only 5 tracks. What is the minimum number of races required to find the 3 fastest horses without using a stopwatch?

806


A building with hight D ft shadow upto G A neighbour building with what height shadow C ft is?

738


My name is deepshikha .if any one have quentiles apptitude question paper please mail me on diffmail172@gmail.com.

3150


Financial aptitude

698


If "PROMPT" is coded as QSPLOS ,then "PLAYER" should be?

1588


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.

832