Java FAQs

Q 1. What is JAVA?

  • Java is a high-level programming language and is platform independent.Java is a collection of objects. It was developed by Sun Microsystems. There are a lot of applications, websites and Games that are developed using Java.

Q 2. What are the features in JAVA?

  • Oops concepts, Object-oriented, Inheritance, Encapsulation, Polymorphism, Abstraction, Platform independent, High Performance, Multi-threaded

Q 3. What is meant by Local variable and Instance variable?

  • Local variables are defined in the method and scope of the variables that have existed inside the method itself.An instance variable is defined inside the class and outside the method and scope of the variables exist throughout the class.

Q 4. What is a Class?

  • Variables are attributes which define the state of a class. All Java codes are defined in a class. A Class has variables and methods.

Q 5. What is an Object?

  • An instance of a class is called object. The object has state and behavior.

Q 6. What is Polymorphism?

  • A single object can refer the super class or sub-class depending on the reference type which is called polymorphism.

Q 7. What is meant by Method Overriding?

  • Method overriding happens if the sub class method satisfies the below conditions with the Super class method: Method name should be same, Argument should be same, Return type also should be same, The key benefit of overriding is that the Sub class can provide some specific information about that sub class type than the super class.

Q 8. What is Synchronization?

  • Synchronization makes only one thread to access a block of code at a time. If multiple thread accesses the block of code, then there is a chance for inaccurate results at the end. To avoid this issue, we can provide synchronization for the sensitive block of codes.

Q 9. What is the purpose of a Volatile Variable?

  • Volatile variable values are always read from the main memory and not from thread’s cache memory. This is used mainly during synchronization. It is applicable only for variables.

Q 10. Difference between Serialization and Deserialization in Java?

  • Serialization is the process which is used to convert the objects into byte stream Deserialization is the opposite process of serialization where we can get the objects back from the byte stream.