Java Software Engineer
Java Software Engineer Interview Questions and Answers for Freshers
Q1. Can we pass values during object creation?
Yes, we can pass values during object creation using constructors.
Constructors are special methods that are called when an object is created.
They can take parameters to initialize the object's state.
Values passed during object creation are used to initialize instance variables.
Example: public class Person { String name; int age; public Person(String name, int age) { this.name = name; this.age = age; } }
Example usage: Person person = new Person("John", 30);
Q2. what are exceptions. How many times are there?
Exceptions are errors that occur during program execution. There are two types: checked and unchecked.
Exceptions are objects that represent errors or exceptional conditions that occur during program execution.
Checked exceptions are checked at compile time and must be handled or declared in the method signature.
Unchecked exceptions are not checked at compile time and can be handled or left to propagate up the call stack.
Examples of exceptions include NullPointerException, Arra...read more
Q3. Explain OOP concepts in Java with real time examples?
OOP concepts in Java with real time examples
Encapsulation - hiding implementation details of a class. Example: private variables in a class
Inheritance - creating a new class from an existing class. Example: subclass extending a superclass
Polymorphism - ability of an object to take many forms. Example: method overloading and overriding
Abstraction - showing only necessary details to the user. Example: abstract classes and interfaces
Q4. Differentiate between Array and Array list in detail with example?
Array is a fixed-size data structure while Array list is a dynamic data structure.
Array has a fixed size while Array list can grow dynamically.
Array can store only homogeneous data types while Array list can store heterogeneous data types.
Array is faster than Array list in terms of accessing elements.
Array list provides more functionality like add, remove, and search.
Example of Array: int[] arr = new int[5]; Example of Array list: ArrayList
list = new ArrayList<>();
Q5. What is Daemon Thread?Give example
Daemon thread is a low priority thread that runs in the background and provides services to user threads.
Daemon threads are used for tasks that don't require user interaction, such as garbage collection.
They can be created using setDaemon() method.
They terminate automatically when all user threads have finished execution.
Example: Timer thread in Java is a daemon thread.
Q6. What is use of static keyword?
Static keyword is used to create class-level variables and methods.
Static variables are shared among all instances of a class
Static methods can be called without creating an instance of the class
Static blocks are used to initialize static variables
Static import is used to import static members of a class
Share interview questions and help millions of jobseekers 🌟
Q7. Explain collection framework In depth
Collection framework is a set of classes and interfaces that provide a way to store and manipulate groups of objects.
Collection framework is part of Java's core libraries.
It includes interfaces like List, Set, and Map, and their respective implementations like ArrayList, HashSet, and HashMap.
Collections can be sorted, searched, and filtered using various methods.
Iterators are used to traverse through collections.
Collections can also be synchronized for thread safety.
Example: ...read more
Q8. Method overloading vs Methodoverriding
Method overloading is having multiple methods with the same name but different parameters. Method overriding is having a method in child class with the same name and signature as in parent class.
Method overloading is compile-time polymorphism
Method overriding is run-time polymorphism
Method overloading is used to provide different ways of calling the same method
Method overriding is used to provide a specific implementation of a method in a child class
Method overloading can hav...read more
Java Software Engineer Jobs
Q9. Current CTC
The current CTC (Cost to Company) is the total salary package of an employee including all benefits and allowances.
CTC includes salary, bonuses, incentives, and other monetary benefits.
It also includes non-monetary benefits like health insurance, retirement plans, and company-provided facilities.
CTC is used to calculate the net salary after deducting taxes and other deductions.
It is an important factor for job seekers to evaluate job offers and negotiate salaries.
Example: Cur...read more
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/Month