Which one is thread safe,(1)Arraylist(2)Vector(3)Map(4)Table?2>What is mean by Singletone object how to create it plz explain

Showing Answers 1 - 4 of 4 Answers

anurag soni

  • Jun 18th, 2006
 

only vector is thread safe.

singleton class is:

we can create only one object of this class. 

  Was this answer useful?  Yes

sbarik

  • Jun 19th, 2006
 

Vector is thread Safe.

Singleton Class is a class of which U can make only one object.The programm checks whether any object of that class exists or nor,if it finds the existing one then returns that Object otherwise creates a new one.. The progamm below shows a Singleton class ..this will help u..

public class SingletonTest

{

    private static SingletonTest obj;

 private SingletonTest()

 {

  /* ..code..*/

 }

public static SingletonTest onlyInstance()

{

  if(obj==null)

  {

    obj=new SingletonTest();

     return obj;

  }

else

return obj;

}

}

  Was this answer useful?  Yes

diala

  • Aug 16th, 2006
 

can some one explain clearly what is thread safe

  Was this answer useful?  Yes

deny eldo

  • Aug 24th, 2006
 

when a class implements singlethreadmodel this class object can acess the code in a synchronized manner. that is one at a time(single thread)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions