Java interview Question- Part1

Posted on:
tags: , , , ,


Java interview Question- Part1


1) What is an object?
    An object is an entity, which consist of attributes, behaviors and qualities that describe the object.

2) What is a class?
    A class represents a collection of attributes and behaviors of object. It is the class from which individual objects created.
For example:-
  Bicycle is a class that contain the following attributes
  Speed
  Gear

3) What is OOAD?
    OOAD stands for Object Oriented analysis and design. It is a methodology use to analyze, design and develop applications. It visualizes the class and the objects.

4) What are the advantages of OOAD?
    * Reusability
    * Maintainability
    * Increase the performance of the system.

5) What is Data Abstraction?
    It is a process of listing the essential features, without implementation details. Data abstraction is nothing but the extraction of the information which is required and ignoring the other information.

6) What is Data Encapsulation?
    Data encapsulation or data hiding is a function that keeps the implementation details hidden to the user. The user of the application is allowed to perform only limited task with the class members that are hidden.

7) What is the difference between data abstraction and information hiding?
    Abstraction mainly focus on the outside view of the object whereas encapsulation prevents the user from seeing the inside view where the properties and behavior of the abstraction is implemented.

8) Why is java not 100% pure OOPS language?
    Java doesn’t support 100% pure OOPS concept, since it support primitive datatype like int, long, byte etc, these are not objects.

9) Qualities for a program to be 100% OOPS language?
     Encapsulation/Data Hiding
     1. Polymorphism
     2. All predifined types are objects
     3. Inheritance
     4. Operations performed through messages to objects
     5. Abstraction
     6. datatypes are to be objects.

10) What is early binding?
    Early binding or static type or static binding is assigning the value of the variable during design phase. Early binding instruct the compiler to allocate space and perform other task before the application starts executing.

11) What are the disadvantages of threads?
    o The main disadvantage of using thread is that it is operating system dependent. It require to follow CPU cycle that various from system to system.
    o Deadlock occurs

12) Why is java case sensitive?
    Java is platform independent language. It is widely used for developing code which contains different variables and hence java is case sensitive.

13) What is singleton class?
     A class which can create a single object at a time is called class. The object is accessible by the java virtual machine. It creates a single instance for the class

14) Objects are passed by value or by reference?
     In java objects are passed by value. Since, the object reference value is passed both the original and the copied parameter will refer to the same object.

15) What is serialization?
     It is a method which saves the object state by converting to byte stream.

16) What is externalizable interface?
     Externalizable interface controls the serialization mechanism. It consist of two methods readexternal and writeexternal. It helps to customize the serialization process.

17) What are the different types of inner classes?
    * Member classes.
    * Anonymous classes.
    * Nested top-level classes.
    * Local classes.

18) What are wrapper classes?
     Wrapper class represents a base class for the data source. It allows the primitive datatype to be accessed as objects.

19) What are the different ways to handle exception?
     * By placing the desired code in the try block and allow the catch block to catch the exception.
     * Desired exception can be placed in throw clause.

20) Is it necessary that each try block must be followed by a catch block?
      It is not essential that try block should be followed by catch block.

21) What is the difference between instanceof() and isInstance()?
      instanceof() is used to see whether the object can be typecast without making use of the exception.
      isInstance() is to check whether the specified object is compatible with the class that represent the object.
 

22) How can you achieve multiple inheritance in java?

      Multiple inheritance in java implemented in similar to the C++ with one difference the inherited interface should be abstract.

23) What is the difference between == and equals methods?
     ‘==’ is used to check whether two numbers are equal
     ‘Equals’ is used to check whether two strings are equal.
  
24) What are java beans?
     Java bean is a platform independent and portable. It helps to develop code that is possible to run in any environment 

25) What is RMI?
     RMI stands for remote method invocation; it enables the developer to create application based on java, in which the java objects are invoked by java virtual machine.

 ---------------------------------------------------------------------------------
Posted By Sundeep aka SunTechie

Sundeep is a Founder of Youth Talent Auzzar, a passionate blogger, a programmer, a developer, CISE and these days he is pursuing his graduation in Engineering with Computer Science dept.
Add Sundeep as a Friend on 

No comments:

Post a Comment

< >