JAVA Thread safety - Explain the term thread safety and synchronization.

Explain the term thread safety and synchronization.

Thread safety:

- It is a computer programming concept.

- The term Thread safety means each method in a multi-threaded environment doesn’t access data by multiple threads at the same time.

- It allows code to run in multi-threaded environments.

- It can be used wrapper classes from java.util.concurrent.atomic.package.

Synchronization:

- Synchronization is the way to provide a secured environment and thus ensure Thread Safety.

- It is working on locking and unlocking resources.

- Synchronized keyword cannot be used for constructors and variables.
Difference between a URL instance and a URL connection instance
URL instance and a URL connection instance - URL instance represents the location of a resource, and a URLConnection instance represents a link for accessing or communicating with the resource at the location...
Explain how to make a connection to a URL
How to make a connection to a URL - Connection to the remote object represented by the URL is only initiated when the connect() method of the URLConnection is called...
Explain how to read from a remote file when we have its URL
How to read from a remote file when we have its URL - With the help of the following code you could directly read from the URL:...
Post your comment