Sample Java Interview Questions

October 2nd, 2007 Admin Posted in Sample Java Interview Questions No Comments »

Inheritance:

Process by which one object acquires the properties of another object. Inheritance allows well-tested procedures to be reused and enables changes to make once and have effect in all relevant places.

Implicit Casting:

Process of simply assigning one entity to another without any transformation guidance to the compiler.

Native method: method that is not implemented in java.

Polymorphism: one name many forms. enables one entity to be used as general category for different types of actions.

Encapsulation: process of binding or wrapping the data and the codes that operates on the data into single entity. This keeps data safe from outside interface and misuse. objects allow procedures to be encapsulated with their data to reduce potential interference. one way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.

Procedural programs: programming logic follows certain procedures and the instructions are executed one after the another. In OOP program, unit of program is object, which is combination of data and code. In procedural program, data is exposed to the whole program whereas in OOPs program, it is accessible with in the object and which in trun assures the security of the code.

What is OOPs?

Object oriented programming organizes a program around its data, ie., objets and a set of welll defined intervaces to that data.

Transient modifier applies to variables only and it is not stored as part or its objects persistent state. Transient variables are not serialized. Volatile modifier applies to variables only and it tells the compiler that the variable modified by volatile can be changed unexpectedly by other parts of the program.

Inner class: classes defined in other classes, including those defined in methods are called inner classes. An inner class can have nay accessibility including private. Anonymous class: class defined inside a mthod without name and is instantiated and declared in the same place and cannot have explicit constructors.

Abstract class: class designed with implementation gaps for subclasses to fill in and is deliberately incomplete. Interface: similar to a class which may contain method’s signature only but no body and it is a formal set of methods and contsant declarations that must be defined by the class that implements it. interfaces are usefull for: declaring methods that one or more classes are expected to implement, capturing similarities between unrelated classes without forcing a class relationship.

AddThis Social Bookmark Button