Showing posts with label JAVA interview Questions. Show all posts
Showing posts with label JAVA interview Questions. Show all posts

JAVA Interview Question

Teamcenter Solution



Q: What is the use of property files in JAVA?

Ans: In most applications, the properties file is loaded during the application startup and is cached for future references. Whenever we need to get a property value by its key, we will refer to the properties cache and get the value from it.

The properties cache is usually a singleton static instance so that the application does not require to read the property file multiple times; because the IO cost of reading the file again is very high for any time-critical application.

Q: Why we may want to generate the hash for a file?

Ans: Any serious file provider provides a mechanism to have a checksum on their downloadable files. A checksum is a form of mechanism to ensure that the file we downloaded is properly downloaded.

Checksum acts like a proof of the validity of a file so if a file gets corrupted this checksum will change and thus let us know that this file is not the same file or the file has been corrupted between the transfer for any reason.

We can also create the checksum of the file to detect any possible change in the file by third party e.g. license files. We provide licenses to clients which they may upload to their server. We can cross verify the checksum of the file to verify that the license file has not been modified after the creation