HCLTech
Taj Techno Interview Questions and Answers
Q1. How to run java program using command line?
To run a Java program using command line, use the 'java' command followed by the name of the class containing the main method.
Navigate to the directory containing the .class file
Type 'java' followed by the name of the class containing the main method
Include any necessary command line arguments after the class name
Press enter to run the program
Example: java MyProgram arg1 arg2
Q2. What is classloader? It's types
Classloader is a part of JVM that loads classes into memory. It has three types: Bootstrap, Extension, and Application.
Classloader loads classes into memory when they are needed by the program
Bootstrap classloader loads core Java classes from the JDK's rt.jar file
Extension classloader loads classes from the JDK's lib/ext directory
Application classloader loads classes from the classpath of the application
Classloader follows delegation model to load classes
Q3. Difference between Hashmap and Hashtable
Hashmap and Hashtable are both used to store key-value pairs, but Hashtable is synchronized and slower than Hashmap.
Hashmap is not synchronized and allows null keys/values.
Hashtable is synchronized and does not allow null keys/values.
Hashmap is faster than Hashtable.
Hashmap is preferred for non-threaded applications.
Hashtable is preferred for threaded applications.
Example: HashMap
map = new HashMap<>(); Example: Hashtable
table = new Hashtable<>();
Q4. Explain Internal working of Hashmap
Hashmap is a data structure that stores key-value pairs and uses hashing to retrieve values quickly.
Hashmap uses an array to store the key-value pairs
The key is hashed to find the index in the array where the value is stored
If two keys hash to the same index, a linked list is used to store multiple values
Hashmap uses load factor to determine when to resize the array
Hashmap provides constant time complexity for insertion, deletion, and retrieval
Q5. What is defect?
A defect is an error or flaw in a software application that causes it to behave unexpectedly or not as intended.
Defects can be caused by coding errors, design flaws, or environmental factors.
Defects can lead to system crashes, data corruption, or security vulnerabilities.
Examples of defects include syntax errors, logic errors, and performance issues.
Defects can be identified through testing, debugging, and code reviews.
Q6. Single ton design pattern
Singleton design pattern ensures a class has only one instance and provides a global point of access to it.
Ensures a class has only one instance
Provides a global point of access to that instance
Commonly used in scenarios where only one instance of a class is needed, such as database connections or configuration settings
Top HR Questions asked in Taj Techno
Interview Process at Taj Techno
Reviews
Interviews
Salaries
Users/Month