Java Trainee
Java Trainee Interview Questions and Answers for Freshers
Asked in Stellar Informatics

Q. What is the difference between Collection and Collections in Java?
Collection is an interface that represents a group of objects while Collections is a utility class that provides methods to operate on collections.
Collection is an interface while Collections is a class
Collection is used to represent a group of objects while Collections provides utility methods to operate on collections
Example of Collection: List, Set, Queue
Example of Collections: sort(), reverse(), shuffle()

Asked in Orange Business

Q. Given an array of numbers, find the second largest number.
To find the second largest number in an array of integers.
Sort the array in descending order and return the second element.
Iterate through the array and keep track of the two largest numbers.
Use a priority queue to find the second largest element.

Asked in Infosys

Q. What is Multithreading?
Multithreading is a programming concept that allows concurrent execution of two or more threads for improved performance.
Multithreading enables parallel execution, improving application responsiveness.
In Java, threads can be created by extending the Thread class or implementing the Runnable interface.
Example: Using Runnable interface to create a thread for a task.
Multithreading is useful in applications like web servers, where multiple requests are handled simultaneously.
Java...read more

Asked in Coforge

Q. What is the Collection Framework?
The Collection Framework in Java provides a set of classes and interfaces for storing and manipulating groups of objects.
Consists of interfaces like List, Set, and Map for different data structures.
ArrayList is a resizable array implementation of the List interface.
HashSet implements the Set interface and stores unique elements.
HashMap stores key-value pairs and allows fast retrieval based on keys.

Asked in TCS

Q. Given an integer, determine whether it is a prime number.
A prime number is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers.
A prime number has exactly two distinct positive divisors: 1 and itself.
Examples of prime numbers include 2, 3, 5, 7, 11, and 13.
The number 1 is not prime because it has only one positive divisor.
The number 4 is not prime because it can be divided by 1, 2, and 4.
Interview Questions of Similar Designations
Interview Experiences of Popular Companies






Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary


Reviews
Interviews
Salaries
Users

