Search Suggest

Core Java - Interview Questions and Answers

41. What is Serialization ?

The process of writing the state of an object to a byte stream. and can restore these objects by using deserialization.
Is also need to implement RMI, which allows a java object of one machine to invoke java object of another machine.

Ie., the object is passed as an argument by serializing it and the receiving machine deserializes it.

42. Interfaces include by java.lang ?

Java.lang is the package of all the classes.
And is automatically imported into all Java programs.

Intefaces : Cloneable, Comparable, Runnable.

43. What is user defined exception?

To handle situations specific to our applications we go for User Defined Exceptions.
and are defined by User using throw keyword.

44. What is the difference between process and threads?

Process is a heavy weight task and is more cost.
Thread is a light weight task which is of low cost.
A Program can contain more than one thread.
A program under execution is called as process.

45. What is the difference between CGI and Servlet ?

CGI suffered serious performance problems. servlets performance is better.
CGI create separate process to handle client request. and Servlets do not.
CGI is platform dependent, whereas Servlet is platform-independent b’cauz written in java.
Servlets can communicate with applets, databases and RMI mechanisms.

46. What is update method called?

This method is called when your Applet has requested that a portion of its window to be redrawn. Default version of update() first fills an applet with the default background color and then calls paint(); This is a default method in the applet class to which we can extend it.

47. What are Vector, Hashtable, LinkedList and Enumeration?

Vector : The Vector class provides the capability to implement a growable array of objects.
Hashtable : The Hashtable class implements a Hashtable data structure. A Hashtable indexes and stores objects in a dictionary using hash codes as the object's keys. Hash codes are integer values that identify objects.
LinkedList: Removing or inserting elements in the middle of an array can be done using LinkedList. A LinkedList stores each object in a separate link whereas an array stores object references in consecutive locations.
Enumeration: An object that implements the Enumeration interface generates a series of elements, one at a time. It has two methods, namely hasMoreElements( ) and nextElement( ). HasMoreElemnts( ) tests if this enumeration has more elements and nextElement method returns successive elements of the series.

48. What are statements in Java (JDBC) ?

Statement -- To be used createStatement() method for executing single SQL statement
PreparedStatement -- To be used preparedStatement() method for executing same SQL statement over and over
CallableStatement -- To be used prepareCall( ) method for multiple SQL statements over and over.

49. What is the base class for all swing components?

Jcomponent

50. What is JFC? java foundation classes

(i) Pluggable Look-and-Feel
(ii) Accessibility API
(iii) Java 2D/API(JDK 1.2).
(iv) Drag and Drop Support(JDK 1.2)

Canvas
Its a component
A rectangular area where the application
can draw or trap input events.

ScrollPane
Its a container.
Implements horizontal and vertical.
scrolling.



Đăng nhận xét