Java Interview Questions With Answer


1. What is Hierarchy in java?

In Hierarchy the commonalties are organized into a tree structured form. at the root any sab tree are found all the attributesand behaviour common to all of the desecdents of that root.

2. What is polymorphism?

polymorphism captures commonality in algorithms .In Object Oriented Program design,polymorphism present a method can has many forms. polymorphism is related to overloading and overridng. '

3. What is abstract class ?

An Abstract class is a class that can only be subclassed. it cannot be Instantiated.

4. What is multiple Inheritance?

Multiple Inheritance has several superclasses and one derived class.

5. What is java?

java is a high level and third generation programming language .

6. What is JDBC

A general facility iteracting with database.

7. What Is Java 3D?

A Facility for developing applications with 3D graphics.

8. What Is Java Features?

  • − Simple
  • − Robust
  • − Portable
  • − interpreted
  • − object Oriented
  • − ditributed
  • − Secure
  • − platform Independent
  • − mutithreaded
  • − Mobile Software

9. What Java Is not Support?

Pointer and Multiple Inheritance.

10. What Is JVM (JAVA VIRTUAL MACHINE)?

jvm is a platform-independent execution environment that converts java bytecode into machine language and executes. java was designed to allow application programs to be built that could be run on any platform without having to be rewritten or recompiled by the programmer for each separate platform.

11. How many types of oops principles.

Encapsulation , Inheritance , polymorphism.

12. What Is Use of Bin Lib In JDK?

Bin Containes all tools such as javac, applet viewer,awt tool etc. whereas Lib Contains All Package And variable.

13. How Many Types Of Data types?

Two Types
primitive, non primitive

14. What Is An Array?

An Array Is An object That Stores a list of items.

15. How Do you declare an array?

Array variable indicates the types of object That The Array holds ex:int arr[].

16. What is static variable ?

Static variable are shared by all instance of a class.

17. What is meant By Variable?

Variables are locations In memory that can holds values. before assigning any value to a variable it must be declared.

18. Which operators is to create and concatenate String?

Addtion Operator (+).

19. What Is String ?

A combinations of characters is called as string.

20. What is final Variable?

if a variable id declared as final variable then you can not change its value i becomes constant.

21. How do we change the values of the elements of the array?

The array subscript expression can be used to change the values of the elements of the array.

22. What are diffrenece between break and continue?

the break keyword halts the execution of the current loop and forces control out of the loop. the continue is similar to break except that instead of halting the execution of the loop it starts the next iteration.

23. Which keyword is used to inherit a class?

Extends

24. What is the difference between superclass & Subclass?

Super class is a class that is inherited whereas subclass that does the inheriting.

25. What are the advantages of inheritance?

Reusability of code and accessibility of variable and methods of the superclass by subclass.

26. What restrictions are placed on method overloading?

two method may not have the same name and arguments list but different return types.

27. What is multithread ?

Multiprogramming is the logically concurrent execution of multiple programs. java support multithreaded programming every thread in java is created and controlled by a unique object of the java.lang.Thread class.

28. What is control statement?

the control statement are used to control the flow of execution of the program the order of execution of the program the order of execution depends on the supplied data values and the conditional logic.

29. What is return statement In java?

It is special branching statement that transfers the control to the caller of the method this statment is used to return a value to the caller method and terminates execution of method.

30. What is classes in java?

A class is a collection of data and methods that operate on that data.the data and method s usually serve to define the content and capabilities of some kind of object.

31. What is constructors?

construtor is a method that can be accessed anywhere in a program with the same name as the class name and it enables an object to initialize itsIf When it's created.

32. What is the use valueOf() method()?

valueOf() method converts data from its internal format into a human-readable form.

33. What are the uses of to LowerCase() and UpperCase() method ?

The method to LowerCase() converts all the characters in a string from uppercase to lowercase. The method to UpperCase() converts all the characters in a string from lowercase to uppercase.

34. What is exception handling in java?

Exception Is a problem that aries in the program during execution. an execution is an event which occurs during the execution of a program. when such an event occurs within a java method , the method creates and exception objects and hands it off the runtime system.