Citi – Java Interview Questions
Here is the list Java Interview Questions which are recently asked in Citi company. These questions are included for both Freshers and Experienced professionals.
1. What is BREAK statement in java?
Break Statement is a loop control statement that is used to terminate the loop. As soon as the break statement is encountered from within a loop, the loop iterations stop there, and control returns from the loop immediately to the first statement after the loop.
2. What is inheritance?
Inheritance is a concept that acquires the properties from one class to other classes; for example, the relationship between father and son. A class can inherit attributes and methods from another class. The class that inherits the properties is known as the sub-class or the child class.
3. Does Java support Multiple Inheritance?
The Java programming language supports multiple inheritance of type, which is the ability of a class to implement more than one interface. As with multiple inheritance of implementation, a class can inherit different implementations of a method defined (as default or static) in the interfaces that it extends.
4. What is method overriding in Java?
If subclass (child class) has the same method as declared in the parent class, it is known as method overriding.
5. What is static and dynamic binding in Java?
Private, final and static members (methods and variables) use static binding while for virtual methods binding is done during run time based upon run time object. Static binding uses Type information for binding while Dynamic binding uses Objects to resolve binding.
6. What is an abstract class in Java?
A class that is declared with abstract keyword is known as abstract class in java. It can have abstract and non-abstract methods. Abstraction is a process of hiding the implementation details and showing only functionality to the user.
7. What is Interface in java?
An interface in the Java programming language is an abstract type that is used to specify a behavior that classes must implement. They are similar to protocols. A class that implements an interface must implement all of the non-default methods described in the interface, or be an abstract class.
8. What is the difference between abstract class and interface?
An abstract class allows to create functionality that subclasses can implement or override. An interface only allows you to define functionality, not implement it whereas a class can extend only one abstract class, it can take advantage of multiple interfaces.
9. What is a constructor in Java?
A constructor in Java is a block of code similar to a method that's called when an instance of an object is created and it doesn't have a return type. The name of the constructor must be the same as the name of the class. Unlike methods, constructors are not considered members of a class.
10. What do you mean by Platform independence of java?
Java is class based and object oriented programming language. It is a platform independent language. JVM recognizes the platform it is on and converts the bytecodes into native machine code. Hence java is called platform independent language.
11. What is difference between JVM, JRE and JDK ?
JDK is a software development kit whereas JRE is a software bundle that allows Java program to run, whereas JVM is an environment for executing bytecode. The full form of JDK is Java Development Kit, while the full form of JRE is Java Runtime Environment, while the full form of JVM is Java Virtual Machine
12. What are memory areas allocated in JVM?
The Java virtual machine memory area is a runtime area that is used for the execution of various programs involved during runtime of a java application, the memory area of JVM is broadly divided into five different parts which are method area, heap area, Stack, Program counter (PC) registers area and Native method area .
13. What are some core concepts of OOPS in Java ?
OOPs is a widely regarded and popular concept because it binds together the data and their functions so that no other part of the code can access that particular data. The main concept of OOPS are Polymorphism, Inheritance, Encapsulation, Abstraction.
14. What is Abstraction?
The abstraction is a process of hiding the implementation details from the user and only provides the functionality to the user. We can show only the relevant information of the object to the user. It helps to reduce programming complexity and effort.
15. What is constructor in java?
A constructor in Java is a block of code similar to a method that's called when an instance of an object is created. It provides information about, and access to, a single constructor for a class.
16. What are access modifier available in java?
A Java access modifier specifies which classes can access a given class and its fields, constructors and methods. Classes, fields, constructors and methods can have one of four different Java access modifiers: private. default (package)
17. Can you explain internal working of HashSet in java?
HashSet uses HashMap internally to store it's objects. Whenever you create a HashSet object, one HashMap object associated with it is also created. This HashMap object is used to store the elements you enter in the HashSet. The elements you add into HashSet are stored as keys of this HashMap object.
TOP 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.