Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Should I use a static variable or Hashtable to store a list of strings?

0
Posted

Should I use a static variable or Hashtable to store a list of strings?

0

The static modifier for a variable is different from the object type of the variable. If you want all servlet instances to be able to read and write data to a field, it should be static. Depending on the nature of the application, it may also be necessary to synchronize access to the variable. If you want to store a simple list of strings, a java.util.List type variable would be most appropriate. A Vector is a List type and its implementation is synchronized.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123