Barclays – Java Interview Questions
Here is the list Java Interview Questions which are recently asked in Barclays company. These questions are included for both Freshers and Experienced professionals.
1. What is Java?
Java is fast, secure general-purpose, class-based, object-oriented programming language designed for having lesser implementation dependencies. It is a computing platform for application development.
2. What do you mean by Constructor?
A constructor is a special method of a class or structure in object-oriented programming that initializes an object of that type. A constructor is an instance method that usually has the same name as the class, and can be used to set the values of the members of an object, either to default or to user-defined values.
3. What are the features of Java?
- Simple.
- Object Oriented.
- Robust and Secure.
- Platform Independent.
- Multi-Threading.
- Architectural Neutral.
- Portable.
4. How does Java enable high performance?
Java uses Just-In-Time compiler to enable high performance which is a program that turns Java bytecode and it contains instructions that must be interpreted into instructions that can be sent directly to the processor.
5. What do you understand by Java IDEs?
A Java IDE is an integrated development environment for programming in Java; many also provide functionality for other languages, IDEs typically provide a code editor, a compiler or interpreter and a debugger that the developer accesses through a unified graphical user interface (GUI).
6. What is an Object?
A Java object is a combination of data and procedures working on the available data. The state of an object is stored in fields (variables), while methods (functions) display the object's behavior. Objects are created from templates known as classes.
7. Could you explain the Oops concepts?
OOPs stands for Object-oriented programming that organizes a program around the various objects and well-defined interfaces. The OOPs Concepts in Java are abstraction, encapsulation, inheritance, and polymorphism which aim to implement real-world entities in programs.
8. Please explain Method Overriding in Java?
If a subclass provides the specific implementation of the method that has been declared by one of its parent class, it is known as method overriding.
Free PDF : Get our updated Java Course Content pdf
9. What do you mean by Overloading?
Method overloading is a feature of Java in which a class has more than one method of the same name and their parameters are different. When more than one method of the same name is created in a Class, this type of method is called Overloaded Methods
10. What is Set in Java? Also, explain its types in a Java Collections.
Set is a collection that contains no duplicate elementsand at most one null element. This interface models the mathematical set abstraction.Java Collection means a single unit of objects. Java Collection framework provides many interfaces (Set, List, Queue, Deque) and classes (ArrayList, Vector, LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet).
11. Please explain the various types of garbage collectors in Java?
There are four types of the garbage collector that can be used according to the requirement: Serial Garbage Collector. Parallel Garbage Collector. Concurrent Mark Sweep (CMS) Garbage Collector.
12. How will you differentiate HashMap from HashTable?
HashMap is non-synchronized and not thread-safe and can't be shared between many threads without proper synchronization code whereas Hashtable is synchronized and is thread-safe and can be shared with many threads.
13. What do you mean by Collections in Java? What are the constituents of Collections in Java?
The Collection is a framework that provides architecture to store and manipulate the group of objects. Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion. Java Collection means a single unit of objects.
14. Please explain Map and their types in Java.
The Map interface provides three collection views, which allow a map's contents to be viewed as a set of keys, collection of values, or set of key-value mappings.There are two interfaces for implementing Map in java: Map and SortedMap, and three classes: HashMap, LinkedHashMap, and TreeMap.
15. What do you mean by Priority Queue in Java?
A priority queue is unbounded, but has an internal capacity governing the size of an array used to store the elements on the queue. It is always at least as large as the queue size. As elements are added to a priority queue, its capacity grows automatically.
16. How do you make a thread in Java? Give examples.
There aretwo ways to create a thread and they are:- By extending Thread class.
- By implementing Runnable interface.
import java.io.*;
class GFG extends Thread {
public void run()
{
System.out.print("Hello World");
}
public static void main(String[] args)
{
GFG g = new GFG(); // creating thread
g.start();
}
}
Get Answer for all the above questions and place in your dream company
Wants to Become an Expert
in Java?
Know MoreTOP MNC's JAVA INTERVIEW QUESTIONS & ANSWERS
Here we listed all Java Interview Questions and Answers which are asked in Top MNCs. Periodically we update this page with recently asked Questions, please do visit our page often and be updated in Java.