Top 30+ Java GUI Interview Questions with Answers - 1
Does String is thread safe in Java?
Strings are immutable, so we can’t change its value in program.
Hence it’s thread safe and can be safely used in multi-threaded environment.
Can we use String in switch case?
Java 7 extended the capability of switch case to use Strings also, earlier versions doesn’t support this.
What are different ways to create String Object?
We can create String Object using new operators like any normal java class or we can use double quotes to create a String object.
There are several constructors available in String class to get String from char array, byte array, StringBuffer and StringBuilder.
What is the difference between StringBuffer and StringBuilder class?
Use StringBuilder whenever possible because it is faster than StringBuffer.
But, if thread safety is necessary then use StringBuffer objects.
What is Hash Code collision?
The idea of hashing is to store an element into array at a position index computed as below.
obtain element_hash_code of the element by processing the element’s data and generating an integer value.
use a simple mod operation to map into the array’s range: index = hash(element) = abs(element_hash_code % array_capacity)
The hash code collision occurs when the index calculated by hash function results same for two or more elements.
7000+ TNPSC Group 1, 2, 4, VAO Indian Economy Study Materials Pdf More
7000+ Gate Computer Science Engineering Previous Year Questions More
7000+ Fill in the Blanks with Suitable Homonyms More
7000+ Fill in the Blanks with Suitable Homophones More
Power Semiconductor Device and Integrated Circuits MCQ Questions Pdf More
TNPSC Group 1, 2 Biology Model Question Paper 2019-2020 More
100+ SSC General English Solved Question Papers with Answers Pdf More
XML .Net Interview Questions and Answers for Experienced More
1000+ Important Days and Dates Pdf More
Oracle Interview Questions and Answers Pdf Free Download More