This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes interview questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "interview questions" Watch "interview questions" New topic
Author

interview questions

Ayub ali khan
Ranch Hand

Joined: Oct 20, 2005
Posts: 380
    
    2
I would appreciate if some one could answer the following questions:

How to calculate the maximum amount of memory that can be allocated to a program?

Different between Array and ArrayList?

How to avoid memory leaks?

Write a program to find the number of times a number is repeated ? eg: {1,2,3,1,1,3}

should return 1 repeated 3 times
2 once and 3 twice. What type of data structure can be used in this scenario?

Thanks in advance.


SCEA part I,TOGAF Foundation
Anupam Bhatt
Ranch Hand

Joined: Mar 12, 2004
Posts: 81
Do read Some stuff. go thorough documentation for Java .. you would get answer to all these questions..search in google..

No fun in getting answers readymade. right?
Ayub ali khan
Ranch Hand

Joined: Oct 20, 2005
Posts: 380
    
    2
Thanks Anupam. I will do that
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
> Different between Array and ArrayList?

Is that:
1. "array"
2. java.lang.reflect.Array
3. java.sql.Array
4. java.util.Arrays


There is no emoticon for what I am feeling!
Praveena Jayanthi
Greenhorn

Joined: Dec 30, 2005
Posts: 10
Q)How to calculate the maximum amount of memory that can be allocated to a program?

java -Xms32m -Xmx128m MyProgram

where 32m is minimum and 128m is maximum

Q)Different between Array and ArrayList

Ans. The ArrayList is a resizeable arrays. In arrays you cannot change the length of arrays once declared.

Q)How to avoid memory leaks

Memory leaks occur due to incomplete deallocation of memory. It could be avoided by deallocating the object references as soon as possible in a program.
Ayub ali khan
Ranch Hand

Joined: Oct 20, 2005
Posts: 380
    
    2
Thanks Praveena and all others who have answered.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: interview questions
 
Similar Threads
finding combinations of string
Am I ready?
Comparing Integers in Array
displaying the most highly repeated entry in an ArrayList
Finding top 3 repeated numbers in an array