Wednesday, December 23, 2009

Interview questions(like diff bettween two) in java


S.No

Abstract

Interface

1

Single inheritance

Multiple inheritance

2

Non abstarct mtd also

Only abstarct mtds

3

Non-static and non-final variables also.

Variables must be static and final(implicitly)

4

Non public members also

Only public mbrs

5

Using extends keyword

Using implements keyword

6

It can invoke if main exists

Pure abtract

7

Faster

Flexible



S.No

Constructor

Method

1

Member function of class.

Ordinary member function.

2

Same as class name.

Own name

3

Invoke using new operator

Invoke using dot operator.

4

No-return type.

It have.



S.No

ArrayList

Vector

1

Its a growable array.

Synchronized ArrayList.

2

Not thread safe

Thread safe.




S.No

HashMap

HashTable

1

Un ordered and un sorted map.

Not thread safe.

Synchronized HashMap. Thread safe.

2

It allows one null key and multiple null values

It wont allow no null key/values.



S.No

AWT

SWING

1

Heay Weight Component.

Light Weight Component.

2

Component use native methods.

Use the methods that r written in java.

3

It have their own viewport which sends the output to the screen.

It does not write itself to the screen, but redirect it to the component it builds

4

Platform dependent.

Platform independent.

5

Old

Its advanced AWT.

1.Its provide additional components like

Jtable,JTabbedPane

2. can add icons and tooltips.

3. built on double buffering.

6

Support Event Delegation Model

MVC architecture,

7

Static Look and feel.

Dynamic Look and feel.


S.No

InvokeAndWait

InvokeLater

1

Synchronous.

Asynchronous.

2

It blocks until runnable task is complete.

It posts an actionevent to the event queue and returns immediately.



S.No

Font

FontMetrics

1

It is used to render text data onto the screen

It provides access to attributes of Font Objects, thing such as charwidth, charheight ,ascents and descent of a font Object.




S.No

String

StringBuffer

1

Immutable(cant change content )

Mutable(can change content using append mtd)

2

Not thread safe.

Thread safe.



S.No

Jlist

JcomboBox

1

Its dont have Editor Component.

It have Editor Component.

2

It allows single,single interval and multiple interval selection.

It allow only single selection.



S.No

Encapsulation

Abstraction

1

It is the mechanism that binds together the code and the data it manipulates and keeps both safe from outside information and misuse.

It denotes the essential characterstics of an object which differentiate from other object.

2

Hiding irrevelents details of an object.

Showing essential things of an object.


1 comment: