8:51 am - Thursday February 22, 2018

Basic Interview Question

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

1.Whats the difference between constructors and normal methods?

Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times and it can return a value or can be void.

2.What is the final keyword denotes?

final keyword denotes that it is the final implementation for that method or variable or class. You cant override that method/variable/class any more.

3.  What is the purpose of Void class?

The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java type void.

4.What is the finalize method do?

Before the invalid objects get garbage collected, the JVM give the user a chance to clean up some resources before it got garbage collected

5.What is JIT and its use?

Really, just a very fast compiler In this incarnation, pretty much a one-pass compiler no offline computations. So you can not look at the whole method, rank the expressions according to which ones are re-used the most, and then generate code. In theory terms, its an on-line problem( JIT is a compiler for Byte code, The JIT-Complier is part of the JVM, it complies byte code into executable code in real time, piece-by-piece on demand basis.)

6.  What is Abstraction ?

Showing the essential and hiding the non-Essential is known as Abstraction.

7.What is Encapsulation?

The Wrapping up of data and functions into a single unit is known as Encapsulation.Encapsulation is the term given to the process of hiding the implementation details of the object. Once an object is encapsulated, its implementation details are not immediately accessible any more. Instead they are packaged and are only indirectly accessed via the interface of the object.

  8.What is mean by Inheritance?

Inheritance is the Process by which the Obj of one class acquires the properties of Objsanother Class.
Inheritance is the method of creating the new class based on already existing class , the new class derived is called Sub class which has all the features of existing class and its own, i.e sub class.
Adv: Reusability of code , accessibility of variables and methods of the Base class by the Derived class.

9.What is Polymorphism?

The ability to take more that one form, it supports Method Overloading & Method Overriding.

10.What is Method overloading ?

When a method in a class having the same method name with different arguments (diff Parameters or Signatures) is said to be Method Overloading. This is Compile timePolymorphism.

When a method in a class having the same method name with different arguments (diff Parameters o

12.What is Method Overriding?

When a method in a sub Class having same method name with same arguments present in a super class it is said to be Method overriding. This is Run time Polymorphism.

13.What is mean by Dynamic dispatch?

Dynamic dispatch is a mechanism by which a call to Overridden function is resolved at runtime rather than at Compile time , and this is how Java implements Run time Polymorphism.

14.What is mean by Dynamic Binding?

Means the code associated with the given procedure call is not known until the time of call the call at run time. (it is associated with Inheritance & Polymorphism).

15.What is mean by Bite code?

Is a optimized set of instructions designed to be executed by Java-run time system, which is called the Java Virtual machine (JVM), i.e. in its standard form, the JVM is an Interpreter for byte code.

16.What is class variable?

A data item associated with a particular class as a whole–not with particular instances of the class. Class variables are defined in class definitions. Also called a static field.

17.What is instance variable?

Any item of data that is associated with a particular object. Each instance of a class has its own copy of the instance variables defined in the class. Also called a field

18.What is local variable?

A data item known within a block, but inaccessible to code outside the block. For example, any variable defined within a method is a local variable and can’t be used outside the method.

19.What is class method ?

A method that is invoked without reference to a particular object. Class methods affect the class as a whole, not a particular instance of the class. Also called a static method.

 20.What is instance method ?

Any method that is invoked with respect to an instance of a class. Also called simply a method.

 21.Define Interface&Rules?

Interfaces can be used to implement the Inheritance relationship between the non-related classes that do not belongs to the same hierarchy, i.e. any Class and anywhere in hierarchy.   Using Interface, you can specify what a class must do but not how it does.

Rules for defining a interface

  • A class can implement more than one Interface.
  • An Interface can extend one or more interfaces, by using the keyword extends.
  • All the data members in the interface are public, static and Final by default.
  • An Interface method can have only Public, default and Abstract modifiers.
  • An Interface is loaded in memory only when it is needed for the first time.
  • A Class, which implements an Interface, needs to provide the implementation of all the methods in that Interface.
  • If the Implementation for all the methods declared in the Interface are not provided , the class itself has to declare abstract, other wise the Class will not compile.
  • If a class Implements two interface and both the Intfs have identical method declaration, it is totally valid.
  • If a class implements tow interfaces both have identical method name and argument list, but different return types, the code will not compile.
  • An Interface cant be instantiated. Intf Are designed to support dynamic method resolution at run time.
  • An interface can not be native, static, synchronize, final, protected or private.
  • The Interface fields can not be Private or Protected.
  • A Transient variables and Volatile variables can not be members of  Interface.
  • The extends keyword should not used after the Implements keyword, the Extends must always come before the Implements keyword.
  • A top level Interface can not be declared as static or final.
  • If an Interface species an exception list for a method, then the  class implementing the interface need not declare the method with  the exception list.
  • If an Interface can not specify an exception list for a method, the class can not throw an exception.
  • If an Interface does not specify the exception list for a method, he class can not throw any exception list.

1 2 3 4 5 6 7 8 9 10

Filed in: Z-A Interview Questions

No comments yet.

Leave a Reply