which of tha following is not a thread safe class?
a) ArrayList b)Vector c)HashTable d)None
Answers were Sorted based on User's Feedback
Answer / gunjan
ArrayList is,unsynchronized, not thread safe, vectors r
thread safe and synchronized
if u want to make Arraylist as thread safe, should use
Collections class synchronizedList(List) method
| Is This Answer Correct ? | 11 Yes | 0 No |
Answer / samir vasani
a)ArrayList
Because ArrayList is not a synchronized ,means it is not a
thread safe
| Is This Answer Correct ? | 6 Yes | 0 No |
Hey Guys n girls...
If you know the Answer Exactly den only post it, V dont want
Guess Answers as wel as Funny Ans, this is the site for not
fun, got it.
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / anonymous
hay submitted guy dun be angry!All person have their own view and assumption.
My answer is ArrayList.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / aravinda reddy
ArrayList is by default not thread safe, but we can make it
thread safe. Below is the example how we can make it thread
safe.
public class SynchronizeList {
public static void main(String[] args) {
ArrayList<String> al=new ArrayList<String>
();
al.add("1");
al.add("2");
al.add("3");
//we can make the synchronized
Collections.synchronizedList(al);
synchronized(al) {
Iterator i = al.iterator(); // Must
be in synchronized block
while (i.hasNext())
System.out.println(i.next());
}
}
}
Vector and HashTable are by default synchronized. These are
thread safe.
Hence the answer is ArrayList.
| Is This Answer Correct ? | 1 Yes | 0 No |
what is request processor?
What is this () in java?
List methods available in Java Queue interface
Which of the following can be referenced by a variable? A. The instance variables of a class only B. The methods of a class only C. The instance variables and methods of a class
What is finalize()?
Can we pass null as argument in java?
what is ejb? what is the importance of ejb?
where to use join method and explain with real time senario?and programatical explenation also..
What is math floor in java?
What is Applet Stub Interface ?
Ducking is automatic in checked exception?True or false
How do you stop a thread in java?