maximum size of arraylist - java

maximum size of arraylist - java

1.what is the maximum size of arraylist? 2.what is the drawback of arralist? 2.what is the drawback of JDBC? 4.how many access specifier and how many access modifier in java? 5.what is difference b/w abstract class and interface? 6.which is best b/w abstract class and interface?

View Answers

February 2, 2012 at 12:53 PM

1) It depend on heap size of machine and heap size depend on size of RAM. The theoretical maximum number of elements in an ArrayList is 2^31-1.

2)Inserting an element in the middle of the array list and removing an element from the middle of the array list are not efficient since the arraylist has to adjust itself to accomodate the new value. Internally it uses System.arrayCopy method which is a native method to copy the contents from old array to new array. If the array list size is very huge, Insertion and removal operations will slow down the performance of the application.

3)Drawbacks of JDBC :

a) JDBC needs database specifc queries. that means if u r using Oracle then u have to use Oracle queries, due to this reason one can't switch between the databases.

b) We can't retrive each record as object. JDBC retrives it as scalar values only. and we know objects are more faster then scalar values.

c) ResultSet is not serializable JDBC, but RowSet is serializable in jdbc. But it is not supported for all drivers.

d) Exception Handling is one of the main drawback in JDBC. eg :

                   try {
                       connection.close();
                   }catch(Exception e) {

                        try {
                              connection.close();

                         }catch(Exception e) {

                         }
                   }

if exception raised closing connection itself , then number of times we need to write try-catch.

e) Each time connection closing is compulsory.

4)Difference between Abstract class and Interface:

a)Interfaces provide a form of multiple inheritance. A class can extend only one other class.

b)Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc.

c)A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class.

d)Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class. Abstract classes are fast.

6)In general, prefer interfaces if you don't need to use an abstract class, because they provide more design flexibility.









Related Tutorials/Questions & Answers:
What?s the maximum size of a row in SQL table?
What?s the maximum size of a row in SQL table?  What?s the maximum size of a row in SQL table?   Hi, The maximum Row Size is 8060 Bytes in a sql table.ADS_TO_REPLACE_1 Thanks
How to find maximum value in ArrayList
How to find maximum value in ArrayList  **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object
Advertisements
How to find maximum value in ArrayList
How to find maximum value in ArrayList  **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object
How to find maximum value in ArrayList
How to find maximum value in ArrayList  **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object
How to find maximum value in ArrayList
How to find maximum value in ArrayList  **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object
Getting the Maximum Size of a Preference Key and Value
Getting the Maximum Size of a Preference Key and Value       This section demonstrates you to get the maximum size of Preference key and value. You can see in the given example that we have
How to find maximum value for userdefined objects in ArrayList
How to find maximum value for userdefined objects in ArrayList  Hi sir,I have requirement i.e finding maximum value in userdefined objects... for employe class and write for below sample code ,in this code i can findout maximum
How to find maximum value for userdefined objects in ArrayList
How to find maximum value for userdefined objects in ArrayList  Hi sir,I have requirement i.e finding maximum value in userdefined objects... for employe class and write for below sample code ,in this code i can findout maximum
How to find maximum value for userdefined objects in ArrayList
How to find maximum value for userdefined objects in ArrayList  Hi sir,I have requirement i.e finding maximum value in userdefined objects... for employe class and write for below sample code ,in this code i can findout maximum
What is the maximum size of a file that can be uploaded using PHP and how can we change this?
What is the maximum size of a file that can be uploaded using PHP and how can we change this?  What is the maximum size of a file that can be uploaded using PHP and how can we change
ArrayList
ArrayList  import java.util.*; class ArrayListDemo2 { public static void main(String args[]) { ArrayList al=new ArrayList(); al.add("one"); al.add("two"); al.add("three"); al.add("four"); for(int i=0;i Expected
arraylist
arraylist  Hi How can we eliminet duplicate element from arraylist? How can we find highest salary from arraylist ? How can we highest key value pair from map? Thanks Kalins Naik   Remove duplicates from Arraylist
arraylist
arraylist  Hi i have class A , i have added employee name and id in arraylist, then how can i find out all infomation of class A using emplyee... data into an arraylist and display the data of the particular employee according
arraylist
% *(noOfYearService/2). Store each employee information in different arrayList depending on his
arraylist of an arraylist
arraylist of an arraylist  Can anyone suggest me how to use arraylist of an arraylist?? how to put data into it and get data from it???? becoz i want to make rows and column dynamic which can grow as per requirement?????/ plz
Servletoutputstream size limit.
Servletoutputstream size limit.  What is the maximum size of ServletOutputStream
Servletoutputstream size limit.
Servletoutputstream size limit.  What is the maximum size of ServletOutputStream?   By default size is set to 10MB.You can increase your message size maximum 2000000000 bytes. That is size limit is 2000000000
arraylist and vector
arraylist and vector  what is the diff b/w arraylist and vector
ArrayList and Vector
ArrayList and Vector  hello, Why ArrayList is faster than Vector?   hii,ADS_TO_REPLACE_1 ArrayList is faster than Vector, because ArrayList is not synchronized. Synchronization will reduce the performance of Vector
Size of commarea
Size of commarea  hii, What is the size of commarea?   hello,ADS_TO_REPLACE_1 Default size of commarea is 65k
Collection : ArrayList Example
of ArrayList : " + size); // Adding elements in ArrayList list.add(333...(); System.out.println("Size of ArrayList after adding elements : " + size); System.out.println("Elements of ArrayList : "); for (int i = 0; i < size
ArrayList object
ArrayList object  i have am ArrayList object it containg data base records in it, now i want to display this ArrayList object data in my jsp programe, plz help me
ArrayList elements
ArrayList elements  how to print ArrayList elements in reverse order... ArrayListReverse { public static void main(String[] args) { ArrayList list=new ArrayList(); list.add("Innova"); list.add("Alto
comparing arraylist of an multi dimensional arraylist
comparing arraylist of an multi dimensional arraylist  can anyone help me in solving the following issue: actually i have an arraylist called dany... have to compare each arraylist with each other. like i have to take 1st arraylist
Size in FLex
Size in FLex  Hi..... What is the difference between width, explicitWidth, measuredMinWidth, measuredWidth, and percentWidth? please tell me about that difference Thanks
Size in FLex
Size in FLex  Hi... I just want to know about... What happens in measure()? measuredHeight, measuredWidth, measuredMinHeight, measuredMinWidth are set. please give me an example with description... Thanks
vector and arraylist
vector and arraylist    suppose i have class A { public static arrylist a1(){} class B{ public static vector b1() {} } my question is how to class B method in Class A and how to get vector object values in class A without
arraylist problems?
arraylist problems?   myprogram needs to ask the user for a file name. The file will contain a name on each line. Put each of the names into an ArrayList. After you have put all of the names into the ArrayList search through
maximum open cursors exceeded - JMS
maximum open cursors exceeded  Hi, i m getting error java.sql.SQLException: ORA-01000: maximum open cursors exceeded in java.could u tell me why???? Thanks Narendra
arraylist
arraylist  Hi how can we eliminet duplicate element from arraylist in java? how can we achieve data abstrcation and encapulation in java? how many type of modifier are there in java? Thanks kalins anik   Remove
ArrayList
arraylist
arraylist
arraylist   Using arraylist class , what type of exception are throws, how can write a java programe   An ArrayList can throw... ArraylistException { void buildAlphabet() { ArrayList list = new ArrayList
arrayList
Table maximum Row count - JDBC
Table maximum Row count  Dear friends I want to select maximum... 5 7 5 3 4 5 2 5 1 my output will be 5 means 5 is maximum time... maximum time entry value? Thanks in advance Rajkumar  Hi friend
Maximum number of catches for a try block
Maximum number of catches for a try block  How many catch statements are allowed for a try statement?   Hello Friend, You can use any number of catch statement for a try statement. Thanks
Exceeeded maximum number of redirects: 5
Exceeeded maximum number of redirects: 5  Hi, I am testing on a project ( HTML + Flex ) using jmeter and getting this error in between: java.io.IOException: Exceeeded maximum number of redirects: 5
Exceeeded maximum number of redirects: 5
Exceeeded maximum number of redirects: 5  Hi, I am testing on a project ( HTML + Flex ) using jmeter and getting this error in between: java.io.IOException: Exceeeded maximum number of redirects: 5
To insert maximum number of data in database.
To insert maximum number of data in database.  how to change string data type into clob data type in jsp   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 http://www.roseindia.net/jdbc/insert-clob
Maximum length of Session ( $_SESSION ) in PHP.
Maximum length of Session ( $_SESSION ) in PHP.  sir, i want to know that how much limit of storing data into session in php. i mean can i store full product descriptions into session. Thank u
track file size changes
track file size changes  How to track a change in file size
javascript max size
javascript max size   How to retrive Max size in JavaScript
JSP List Size
JSP List Size          JSP List Size is used to get the size of the list. The JSP List Size uses array list object to add the elements and finally
Remove multiple elements in arraylist
Remove multiple elements in arraylist   how can we remove multiple values in arrayList? only remove method we used for single remove.but i want to delete multiple value in arrayList
hibernate.jdbc.batch_size
In this section, you will learn about the hibernate.jdbc.batch_size of the hibernate.cfg.xml.
ArrayList as an argument to another class
ArrayList as an argument to another class  how do you pass arraylists as arguments to another class, and how does the method/class accept this arraylist for use
How to Convert ArrayList to Array?
How to Convert ArrayList to Array?  Hi, I am trying to learn to Convert ArrayList to Array. How it is possible? How to Convert ArrayList to Array? Thanks   Hi, To Convert ArrayList to array ArrayList.toArray
Fixed size tables
Fixed size tables  Can anyone help me in creating a fixed size table in mysql database
Printing ArrayList - JSP-Servlet
Printing ArrayList   I have a code in servlet like this ArrayList total = new ArrayList (); session.setAttribute("efg",total...(request,response); to print the values in ArrayList total, I did this in my JSP
How to show the maximum and the minimum in array...
How to show the maximum and the minimum in array...  I have a bookstore application, but I cannot show the maximum and the minimum price of the book. Please see my codes below. import java.util.*; public class Book{ public

Ads