You are on page 1of 16

JAVA QUESTIONS

1. ODBC Ans. Open Database Connectivity.


2. HT! Ans. Hype" Te#t a"$%p !an&%a&e
'. (ISC Ans. (e)%ce) Inst"%ction Set Co*p%tin&
+. ASCII Ans. A*e"ican Stan)a") Co)e ,o" In-o"*ation Inte"c.an&e
/.ANSI Ans. A*e"ican Nationa0 Stan)a") Instit%te.
1. 2! Ans. E#ten)e) a"$%p !an&%a&e
3. ,!O4S Ans. ,0oatin& 4oint Ope"atin& 4e" Secon)
5. SQ! Ans. Se6%entia0 Q%e"y !an&%a&e
7. QBE Ans. Q%e"y By E#a*p0e
18. A!E Ans. A))"ess !atc. Enab0e
12. (4C (e*ote p"oce)%"e ca00
11. 9.at is 0a&&in& in DBS : Ans. (e)%ce) (e)%n)ancy.
9.at is JAVA :
Java is a pure object oriented programming language, which has derived C syntax
and C++ object oriented programming features.
Is a compiled and interpreted language and is platform independent and
Can do graphics, networking, multithreading. It was initially called as OA;.
9.at " t.e -o%" co"ne"stones o- OO4 :
bstraction ! Can manage complexity through abstraction. "ives the
complete overview of a particular task and the details are handled by its derived classes.
#x ! Car.
#ncapsulation ! $othing but data hiding, like the variables declared under
private of a particular class are accessed only in that class and cannot access in any other
the class.
Inheritance ! Is the process in which one object ac%uires the properties of
another object, ie., derived object.
&olymorphism! 'ne method different forms, ie., method overriding and
interfaces are the examples of polymorphism.
<.at is )o<ncastin& :
(oing a cast from a base class to a more specific class. )he cast does not convert the
object, just asserts it actually is a more specific extended object.
e.g. (alamatian d * +(almatian, a(og-
.ost people will stare blankly at you if you use the word downcast. Just use cast.
9.at is Java Inte"p"ete" :
It is Java /irtual .achine. ie., a java program compiles the Unico)e to intermediary code
called as Byteco)e which is not an executable code. that is executed by Java interpreter.
9.at a"e Java B%==<o")s :
0imple ! #asy to learn.
0ecure ! &rovided by firewalls between networked applications.
&ortable ! Can be dynamically downloaded at various platforms connect to
internet.
''& ! 1our Corner stones.
.ultithread ! Can perform more than one task concurrently in a single program.
2obust ! overcomes problems of de3allocation of memory and exceptions.
Interpreted ! Convert into byte code and the executes by J/..
(istributed ! Concept of 2.I.
(ynamic ! /erifying and accessing objects at run time.
9.at a"e p%b0ic static voi) *ain>St"in& a"&s?@A an) Syste*.o%t.p"int0n>A :
&ublic keyword is an access specifier.
0tatic allows main+, to be called without having to instantiate a particular instance of
class.
/oid does not return any value.
main+, is the method where java application begins.
0tring args45 receives any command line arguments during runtime.
0ystem is a predefined class that provides access to the system.
out is output stream connected to console.
println displays the output.
9.at a"e i)enti-ie"s an) 0ite"a0s :
Identifiers are the variables that are declared under particular datatype.
6iterals are the values assigned to the Identifiers.
9.at is Type) 0an&%a&e :
)his means that the variables are at first must be declared by a particular datatype
whereas this is not the case with javascript.
Scope an) 0i-eti*e o- va"iab0es :
scope of variables is only to that particular block
lifetime will be till the block ends.
variables declared above the block within the class are valid to that inner block also.
Castin& Inco*patib0e types :
Can be done either implicitly and explicitly. ie., int b * +int, c- where c is float.
)here are two types of castings related to classes ! 7, unicast and 8,multicast.
Dec0a"ation o- A""ays :
int a45 * new int4795- int a4545 * new int485485-
9.at )oes St"in& )e-ine :
0tring is an array of characters, but in java it defines an object.
and the variable of type string can be assigned to another variable of type 0tring.
9.at " bit<ise ope"ato"s an) bit<ise 0o&ica0 ope"ato"s :
:, ;, <, =, >>, >>>, ??, ;*, @* and :, ;, <
Ho< )o yo% )e-ine b"ea$ an) !abe0 :
Ae can declare as break ?label name > and the label is declared as ?label name> !
B C.. D-
)he break statement can be declared anywhere in the program ie either inside the label or
outside the label.
De-ine c0ass :
class is a one which defines new datatype, and is template of an object, and is a
protoype.
Types o- Const"%cto"s :
(efault Constructor, &arameteriEed Constructor, Copy Constructors
Ba"ba&e co00ecto" takes the responsibility releasing the memory of object implicitly.
De-ine t.is C -ina0i=eC an) -ina0> -o" va"iab0esC *et.o)sC c0asses A :
t.is is used inside any method to refer to the current object. and is mostly avoided.
-ina0i=e method is used to perform the actions specified in this method just before an
object is destroyed. ie just before garbage collector process.
-ina0 with variables is we cant change the literals of the variables ie nothing but const.
-ina0 with method means we cant override that method.
-ina0 with class means we cannot have derived classes of that particular class.
9.at is passe) by "e-e"ence :
'bjects are passed by reference.
In java we can create an object pointing to a particular location ie $F66 location by
specifying ! ?class name> ?object name>-
and also can create object that allocates space for the variables declared in that particular
class by specifying ! ?object name > * new ?class name>+,-
E#p0ain abo%t Static :
Ahen a member is declared as static it can be accessed before any objects of its class are
created and without any reference to any object.
these are global variables, no copy of these variables can be made.
static can also be declared for methods. and cannot refer to t.is or s%pe".
9.at " neste) c0asses :
)here are two types ! static and non3static.
static c0ass means the members in its enclosing class +class within class, can be accessed
by creating an object and cannot be accessed directly without creating the object.
nonDstatic class means inner class and can be accessed directly with the object created
for the outer class no need to create again an object like static class.
B"ie-0y abo%t s%pe">A :
)his is used to initialiEe constructor of base class from the derived class and also access
the variables of base class like s%pe".i E 18.
*et.o) ove"0oa)in& F same method name with different arguments.
*et.o) ove""i)in& F same method name and same number of arguments.
9.at is Dyna*ic et.o) Dispatc. :
this is the mechanism by which a call to an ove""i))en -%nction is resolved at runtime
rather than at compile time. nd this is how Java implements "%nti*e po0y*o"p.is*.
9.at " abst"act c0asses :
)o create a superclass that only defines generaliEed form that will be shared by all its
subclasses, leaving it to each subclass to fill in the details.
we cannot declare abstract constructors and abstract static methods.
n abstract class contains at least one abstract method.
nd this abstract class is not directly instantiated with ne< operator.
Can create a reference to abstract class and can be point to subclass object.
9.at is ObGect c0ass an) Gava.0an& :
ObGect c0ass is the superclass of all the classes and means that reference variable of type
object can refer to an object of any other class. and also defines methods like
finalise,wait.
Gava.0an& contains all the basic language functions and is imported in all the programs
implicitly.
9.at " pac$a&es an) <.y : .o< to e#ec%te a p"o&"a* in a pac$a&e :
&ackage is a set of classes, which can be accessed by themselves and cannot be accessed
outside the package. and can be defined as package ?pkg name>.
&ackage name and the directory name must be the same.
nd the execution of programs in package is done by ! Gava *ypac$.acco%nt
where mypack is directory name and account is program name.
9.at )oes a Gava so%"ce -i0e can contain :
specifying package name.
importing more than one package
specifying classes and there methods
CCCCCC
9.y inte"-ace an) <.at e#ten)s <.at :
Interface is similar to abstract classes. this define only method declarations and
definitions are specified in the classes which implements these interfaces.
and G one interface multiple methods G signifies the polymorphism concept.
Here an interface can extend another interface.
and a class implements more than one interface.
Ho< E#ception .an)0in& is )one in Java :
Is managed via I keywords !
t"y F statements that you want to monitor the exceptions contain in try block.
catc. F the exception thrown by try is catched by this.
t."o< F to manually throw exception we go for this.
t."o<s F #xception that is thrown out of a method must be specified by throws after the
method declaration.
-ina00y F this block is executed whether or not an exception is thrown. and also it is
executed just before the method returns. and this is optional block.
9.at " c.ec$e) an) %nc.ec$e) E#ceptions :
J Fnchecked #xceptions are those which r not included in t."o<s list and are derived
from (%nti*eE#ception which are automatically available and are in java.lang.
J Checked #xceptions are those which cannot handle by itself.
9.at is T."ea) an) *%0tit."ea) : Ho< is t."ea) c"eate) :
)hread is a small unit of dispatchable code. ie., a single program can perform more than
one task simultaneously. )his is a light weight process and is of low cost.
.ulti)hreading writes more efficient programs and make maximum use of C&F ie., it
minimiEes its idle time.
)hread is created in two ways !
7, Ky implementing the runnable interface.
8, Ky extending the )hread class itself.
1irst way is used to update only run+, method. ie we can use only run+, method in this
class.
0econd way is used to define several methods overridden by derived class.
"enerally we override only run+, method so we go for runnable interface.
9.at a"e t.e va"io%s states an) *et.o)s o- t."ea) :
States F 2unning, 2eady to run, 0uspended, 2esumed, blocked and terminated.
et.o)s F get$ame, get&riority, islive, join, run, sleep, start.
)hread priorities are .I$L&2I'2I)M, .NL&2I'2I)M, $'2.L&2I'2I)M.
9.at is inte"p"ocess sync."oni=ation : > a0so ca00e) onito"C Se*ap.o"e A
Consider a small box namely .'$I)'2 that can hold only one thread. 'nce a
thread enters a monitor, all other threads must wait until that thread exits the monitor.
In this way, a monitor can be used to protect a shared asset from being
manipulated by more than one thread at a time.
'nce a thread is inside a synchroniEed method, no other thread can call any other
synchroniEed method on the same object.
9.at is St"ea* :
It is an bstraction that either produces or consumes information.
T<o types F Kyte 0tream and Character 0tream.
4"int 9"ite" is to &rint output in 2eal Aorld &rograms.
Ho< to ente" )ata in Gava :
1irst specify !
Kuffered2eader br * new Kuffered2eader+new
Input0tream2eader+0ystem.in,,-
then say br.read+,, and this is put in do while loop to receive as many as we re%uire.
De-ine In0ine ,%nctions :
In ordinary functions, during the program execution, at any function call the
controller jumps to the function definition, performs operation and returns the value, then
comes back to the program.
whereas in Inline functions the controller copies the complete function definition into the
program and performs operations.
9.at a"e t.e -o%" co*ponents in U(! :
http!OO www. yahoo .com ! P9P9 O index.html
http! 333 > is protocol
www. yahoo .com 333 is I& address
P9P9 33 port number and is a pointer to memory location.
index.html 33 file path to be loaded
9.at is a St"in&To$eni=e" :
0tring )okeniEer provide parsing process in which it identifies the delimiters
provided by the user , by default delimiters are spaces, tab, newline etc. and separates
them from the tokens. )okens are those which are separated by delimiters.
9.at a"e *ac"os an) In0ine -%nctions : 9.ic. is best an) Di--e"ence :
Inline functions do &arameter passing, where as .acros do )ext 0ubstitution.
Its better to go for Inline functions than macros, else you may get different results.
Ho< to Dec0a"e a pointe" to -%nction :
int funcLname+float, OOordinary declaration of function.
int +JfuncLnameLptr,+float, OO (eclaration of pointer.
Assi&nin& t.e A))"ess can be )one as !
funcLnameLptr * funcLname. OO 2eturn type and 0ignatures must be
0ame.
Invo$in& a -%nction pointe" F int x * +JfuncLnameLptr,+values as specified,-
9.at is a -i0e : 9.at is a Di"ecto"y :
1ile ! (escribes the properties of file, like permissions, time, date, directory path, and to
navigate subdirectory hierarchies.
(irectory ! Is a file that contains list of other files and directories .
9.at is Se"ia0i=ation :
)he process of writing the state of an object to a byte stream. and can restore these
objects by using deserialiEation.
Is also need to implement 2.I, which allows a java object of one machine to invoke java
object of another machine.
ie., the object is passed as an argument by serialiEing it and the receiving machine
deserialiEes it.
Inte"-aces inc0%)e by Gava.0an& :
Java.lang is the package of all the classes.
nd is automatically imported into all Java programs.
Intefaces ! Cloneable, Comparable, 2unnable.
9.at is %se" )e-ine) e#ception:
)o handle situations specific to our applications we go for Fser (efined #xceptions.
and are defined by Fser using t."o< keyword.
9.at is t.e )i--e"ence bet<een p"ocess an) t."ea)s:
&rocess is a heavy weight task and is more cost.
)hread is a light weight task which is of low cost.
&rogram can contain more than one thread.
program under execution is called as process.
9.at is t.e )i--e"ence bet<een CBI an) Se"v0et :
C"I suffered serious performance problems. servlets performance is better.
C"I create separate process to handle client re%uest. and 0ervlets do not.
C"I is platform dependent, whereas 0ervlet is platform3independent bQcauE written in
java.
0ervlets can communicate with applets, databases and 2.I mechanisms.
9.at is %p)ate *et.o) ca00e):
)his method is called when your pplet has re%uested that a portion of its window
to be redrawn. (efault version of update+, first fills an applet with the default background
color and then calls paint+,- )his is a default method in the applet class to which we can
extend it.
9.at a"e Vecto"C Has.tab0eC !in$e)!ist an) En%*e"ation:
Vecto" F )he /ector class provides the capability to implement a growable array of
objects. Has.tab0e F )he Hashtable class implements a Hashtable data structure.
Hashtable indexes and stores objects in a dictionary using hash codes as the objectRs keys.
Hash codes are integer values that identify objects.
!in$e)!istF 2emoving or inserting elements in the middle of an array can be done using
6inked6ist. 6inked6ist stores each object in a separate link whereas an array stores
object references in consecutive locations.
En%*e"ationF n object that implements the #numeration interface generates a series of
elements, one at a time. It has two methods, namely has.ore#lements+ , and
next#lement+ ,. Has.ore#lemnts+ , tests if this enumeration has more elements and
next#lement method returns successive elements of the series.
9.at a"e state*ents in Java >JDBCA :
0tatement 33 )o be used create0tatement+, method for executing single 0S6 statement
&repared0tatement 33 )o be used prepared0tatement+, method for executing same 0S6
statement over and over
Callable0tatement 33 )o be used prepareCall+ , method for multiple 0S6 statements
over and over.

9.at is a JA( -i0e:
Jar file allows to efficiently deploying a set of classes and their associated
resources. )he elements in a jar file are compressed, which makes downloading a Jar file
much faster than separately downloading several uncompressed files.
)he package java.util.Eip contains classes that read and write jar files.
9.at is JNI:
java native interface ! )he machanism to integrate C code with a java program is called
the Java $ative Interface.
9.at is t.e base c0ass -o" a00 s<in& co*ponents:
Jcomponent
9.at is J,C: Gava -o%n)ation c0asses
+i, &luggable 6ook3and31eel
+ii, ccessibility &I
+iii, Java 8(O&I+J(T 7.8,.
+iv, (rag and (rop 0upport+J(T 7.8,
Canvas Sc"o004ane
Its a component Its a container.
rectangular area where the application Implements horiEontal and vertical
can draw or trap input events. scrolling.
32A 9.at is t.e )i--e"ence bet<een JDBC an) ODBC:
a, 'K(C is for .icrosoft and J(KC is for Java applications.
b, '(KC canRt be directly used with Java because it uses a C interface.
c, '(KC makes use of pointers which have been removed totally from Java.
d, '(KC mixes simple and advanced features together and has complex options for
simple %ueries. Kut J(KC is designed to keep things simple while allowing advanced
capabilities when re%uired.
e, '(KC re%uires manual installation of the '(KC driver manager and driver on all
client machines. J(KC drivers are written in Java and J(KC code is automatically
installable, secure, and portable on all platforms.
f, J(KC &I is a natural Java interface and is built on '(KC. J(KC retains
some of the basic features of '(KC.
3'A 9.at a"e t.e types o- JDBC D"ive" o)e0s an) e#p0ain t.e*:
T<o tie" *o)e0F In this model, Java applications interact directly with the database.
J(KC driver is re%uired to communicate with the particular database management system
that is being accessed. 0S6 statements are sent to the database and the results are given to
user. )his model is referred to as clientOserver configuration where user is the client and
the machine that has the database is called as the server.
T."ee tie" *o)e0F middle tier is introduced in this model. )he functions of this model
are!
a, Collection of 0S6 statements from the client and handing it over to the database,
b, 2eceiving results from database to the client and
c, .aintaining control over accessing and updating of the above.
3+A 9.at a"e t.e steps invo0ve) -o" *a$in& a connection <it. a )atabase o" .o< )o
yo% connect to a )atabase:
aA !oa)in& t.e )"ive" F )o load the driver, Class.for$ame+ , method is used.
Class.for$ame+Usun.jdbc.odbc.Jdbc'dbc(riverU,-
Ahen the driver is loaded, it registers itself with the java.s%l.(river.anager class as an
available database driver.
bA a$in& a connection <it. )atabase F )o open a connection to a given database,
(river.anager.getConnection+ , method is used.
Connection con * (river.anager.getConnection +Ujdbc!odbc!somedbU, UuserU,
UpasswordU,-
cA E#ec%tin& SQ! state*ents F )o execute a 0S6 %uery, java.s%l.statements class is
used.
create0tatement+ , method of Connection to obtain a new 0tatement object.
0tatement stmt * con.create0tatement+ ,-
%uery that returns data can be executed using the executeSuery+ , method of
0tatement. )his method executes the statement and returns a java.s%l.2esult0et that
encapsulates the retrieved data! 2esult0et rs * stmt.executeSuery+U0#6#C) J 12'.
some tableU,-
)A 4"ocess t.e "es%0ts F 2esult0et returns one row at a time. $ext+ , method of
2esult0et object can be called to move to the next row. )he get0tring+ , and get'bject+ ,
methods are used for retrieving column values!
while+rs.next+ , , B 0tring event * rs.get0tring+UeventU,-
'bject count * +Integer, rs.get'bject+UcountU,-
33A 9.at is sto"e) p"oce)%"e:
ns! 0tored procedure is a group of 0S6 statements that forms a logical unit and
performs a particular task. 0tored &rocedures are used to encapsulate a set of operations
or %ueries to execute on database. 0tored procedures can be compiled and executed with
different parameters and results and may have any combination of inputOoutput
parameters.
35A Ho< to c"eate an) ca00 sto"e) p"oce)%"es:
ns! To c"eate sto"e) p"oce)%"esF
Create procedure procedurename +specify in, out and in out parameters,
K#"I$
ny multiple 0S6 statement-
#$(-
To ca00 sto"e) p"oce)%"esF
Callable0tatement csmt * con.prepareCall+UBcall procedure name+V,V,DU,-
csmt.register'ut&arameter+column no., data type,-
csmt.setInt+column no., column name,
csmt.execute+ ,-
37A 9.at is se"v0et:
ns! 0ervlets are modules that extend re%uestOresponse3oriented servers, such as java3
enabled web servers. 1or example, a servlet might be responsible for taking data in an
H).6 order3entry form and applying the business logic used to update a companyRs
order database.
51A 9.at is t.e )i--e"ence bet<een an app0et an) a se"v0et:
0ervlets are to servers what applets are to browsers.
pplets must have graphical user interfaces whereas servlets have no graphical user
interfaces.
52A 9.at is t.e )i--e"ence bet<een )o4ost an) )oBet *et.o)s:
a, do"et+, method is used to get information, while do&ost+ , method is used for posting
information.
b, do"et+, re%uests canRt send large amount of information and is limited to 8W938II
characters. However, do&ost+ ,re%uests passes all of its data, of unlimited length.
c, do"et+ , re%uest is appended to the re%uest F26 in a %uery string and this allows the
exchange is visible to the client, whereas a do&ost+, re%uest passes directly over the
socket connection as part of its H))& re%uest body and the exchange are invisible to the
client.
5'A 9.at is t.e 0i-e cyc0e o- a se"v0et:
ns! #ach 0ervlet has the same life cycle!
a, server loads and initialiEes the servlet by init +, method.
b, )he servlet handles Eero or more clientRs re%uests through service+ , method.
c, )he server removes the servlet through destroy+, method.
5+A 9.o is 0oa)in& t.e init>A *et.o) o- se"v0et:
ns! Aeb server
5/A 9.at a"e t.e )i--e"ent se"ve"s avai0ab0e -o" )eve0opin& an) )ep0oyin& Se"v0ets:
ns! a, Java Aeb 0erver
b, J2un
g, pache 0erver
h, $etscape Information 0erver
i, Aeb 6ogic
51A Ho< *any <ays can <e t"ac$ c0ient an) <.at a"e t.ey:
ns! )he servlet &I provides two ways to track client state and they are!
a, Fsing 0ession tracking and b, Fsing Cookies.
78A Is it possib0e to co**%nicate -"o* an app0et to se"v0et an) .o< *any <ays an)
.o<:
ns! Mes, there are three ways to communicate from an applet to servlet and they are!
a, H))& Communication+)ext3based and object3based,
b, 0ocket Communication
c, 2.I Communication
Steps invo0ve) -o" app0etDse"v0et co**%nicationF
7, "et the server F26. F26 url * new F26+,-
8, Connect to the host F26Connection Con * url.openConnection+,-
X, InitialiEe the connection Con.setFseCatches+false,!
Con.set(o'utput+true,-
Con.set(oInput+true,-
W, (ata will be written to a byte array buffer so that we can tell the server the length
of the data. Kyterray'utput0tream byteout * new
Kyterray'utput0tream+,-
I, Create the 'utput0tream to be used to write the data to the buffer.
(ata'utput0tream out * new (ata'utput0tream+byteout,-
71A 9.at is connection poo0in&:
ns! Aith servlets, opening a database connection is a major bottleneck because we are
creating and tearing down a new connection for every page re%uest and the time taken to
create connection will be more.
Creating a connection pool is an ideal approach for a complicated servlet. Aith a
connection pool, we can duplicate only the resources we need to duplicate rather than the
entire servlet. connection pool can also intelligently manage the siEe of the pool and
make sure each connection remains valid. number of connection pool packages are
currently available. 0ome like (bConnectionKroker are freely available from Java
#xchange Aorks by creating an object that dispenses connections and connection Ids on
re%uest.
)he Connection&ool class maintains a Hastable, using Connection objects as keys
and Koolean values as stored values. )he Koolean value indicates whether a connection is
in use or not. program calls getConnection+ , method of the Connection&ool for getting
Connection object it can use- it calls returnConnection+ , to give the connection back to
the pool.
72A 9.y s.o%0) <e &o -o" inte"se"v0et co**%nication:
0ervlets running together in the same server communicate with each other in several
ways.
T.e t."ee *aGo" "easons to %se inte"se"v0et co**%nication a"eF
a, (irect servlet manipulation 3 allows to gain access to the other currently loaded
servlets and perform certain tasks +through the 0ervletContext object,
b, 0ervlet reuse 3 allows the servlet to reuse the public methods of another servlet.
c, 0ervlet collaboration 3 re%uires to communicate with each other by sharing
specific information +through method invocation,
7'A Is it possib0e to ca00 se"v0et <it. pa"a*ete"s in t.e U(!:
ns! Mes. Mou can call a servlet with parameters in the syntax as +V&aram7 * xxx << m8 *
yyy,.
7+A 9.at is Se"v0et c.ainin&:
0ervlet chaining is a techni%ue in which two or more servlets can cooperate in servicing a
single re%uest. In servlet chaining, one servletRs output is piped to the next servletRs input.
)his process continues until the last servlet is reached. Its output is then sent back to the
client.
7/A Ho< )o se"v0ets .an)0e *%0tip0e si*%0taneo%s "e6%ests:
)he server has multiple threads that are available to handle re%uests. Ahen a re%uest
comes in, it is assigned to a thread, which calls a service method +for example! do"et+,,
do&ost+ , and service+ , , of the servlet. 1or this reason, a single servlet object can have its
service methods called by many threads at once.
71A 9.at is t.e )i--e"ence bet<een TC4HI4 an) UD4:
ns! )C&OI& is a two3way communication between the client and the server and it is a
reliable and there is a confirmation regarding reaching the message to the destination. It
is like a phone call.
F(& is a one3way communication only between the client and the server and it is
not a reliable and there is no confirmation regarding reaching the message to the
destination. It is like a postal mail.
73A 9.at is Inet a))"ess:
ns! #very computer connected to a network has an I& address. n I& address is a
number that uni%uely identifies each computer on the $et. n I& address is a X83bit
number.
75A 9.at is Do*ain Na*in& Se"vice>DNSA:
ns! It is very difficult to remember a set of numbers+I& address, to connect to the
Internet. )he (omain $aming 0ervice+($0, is used to overcome this problem. It maps
one particular I& address to a string of characters.
1or example, www.mascom.com implies com is the domain name reserved for F0
commercial sites, moscom is the name of the company and www is the name of the
specific computer, which is mascomRs server.
77A 9.at is U(!:
ns! F26 stands for Fniform 2esource 6ocator and it points to resource files on the
Internet.
F26 has four components!
http!OOwww.&entafour.com!P9Oindex.html
http 3 protocol name, &entafour 3 I& address or host name, P9 3 port number and
index.html 3 file path.

188A 9.at is (I an) steps invo0ve) in )eve0opin& an (I obGect:
ns! 2emote .ethod Invocation +2.I, allows java object that executes on one machine
and to invoke the method of a Java object to execute on another machine.
)he steps involved in developing an 2.I object are!
a, (efine the interfaces
b, Implementing these interfaces
c, Compile the interfaces and their implementations with the java compiler
d, Compile the server implementation with 2.I compiler
e, 2un the 2.I registry
f, 2un the application
181A 9.at is (I a"c.itect%"e:
a, pplication layer 3333 contains the actual object definition
b, &roxy layer 3333 consists of stub and skeleton
c, 2emote 2eference layer 3333 gets the stream of bytes from the transport layer
and sends it to the proxy layer
d, )ransportation layer 3333 responsible for handling the actual machine3to3
machine communication
182A <.at is Unicast(e*oteObGect:
ns! ll remote objects must extend Fnicast2emote'bject, which provides functionality
that is needed to make objects available from remote machines.
18'A E#p0ain t.e *et.o)sC "ebin)> A an) 0oo$%p>A in Na*in& c0ass:
ns! rebind+ , of the $aming class+found in java.rmi, is used to update the 2.I registry
on the server machine. $aming. rebind+Udd0everU, dd0erverImpl,-
lookup+ , of the $aming class accepts one argument, the rmi F26 and returns a
reference to an object of type dd0erverImpl.
18+A 9.at is a Java Bean:
ns! Java Kean is a software component that has been designed to be reusable in a
variety of different environments.
181A 9.at is BD;:
ns! K(T, Kean (evelopment Tit is a tool that enables to create, configure and connect
a set of set of Keans and it can be used to test Keans without writing a code.

183A 9.at is JS4:
ns! J0& is a dynamic scripting capability for web pages that allows Java as well as a few
special tags to be embedded into a web file +H).6ON.6, etc,. )he suffix traditionally
ends with .jsp to indicate to the web server that the file is a J0& files. J0& is a server side
technology 3 you canRt do any client side validation with it.
T.e a)vanta&es a"eF
a, )he J0& assists in making the H).6 more functional. 0ervlets on the other hand
allow outputting of H).6 but it is a tedious process.
b, It is easy to make a change and then let the J0& capability of the web server you
are using deal with compiling it into a servlet and running it.
185A 9.at a"e JS4 sc"iptin& e0e*ents:
ns! J0& scripting elements lets to insert Java code into the servlet that will be generated
from the current J0& page.
T.e"e a"e t."ee -o"*sF
a, #xpressions of the form ?Y* expression Y> that are evaluated and inserted into
the output,
b, 0criptlets of the form ?Y code Y> that are inserted into the servletRs service
method, and
c, (eclarations of the form ?Y@ Code Y> that are inserted into the body of the
servlet class, outside of any existing methods.
187A 9.at a"e JS4 Di"ectives:
ns! J0& directive affects the overall structure of the servlet class. It usually has the
following form! ?YZ directive attribute*UvalueU Y>
However, you can also combine multiple attribute settings for a single directive, as
follows! ?YZ directive attribute7*Uvalue7U attribute 8*Uvalue8U ... attribute$
*Uvalue$U Y>
)here are two main types of directive! page, which lets to do things like import
classes, customiEe the servlet superclass, and the like- and include, which lets to insert a
file into the servlet class at the time the J0& file is translated into a servlet
118A 9.at a"e 4"e)e-ine) va"iab0es o" i*p0icit obGects:
ns! )o simplify code in J0& expressions and scriptlets, we can use eight automatically
defined variables, sometimes called implicit objects. )hey are re%uest, response, out,
session, application, config, pageContext, and page.
/. 9.at is Bootst"appin& in (I:
(ynamic loading of stubs and skeletons is known as Koot 0trapping.
1. 9.at a"e )i--e"ent types o- E#ceptions:.
2untime exceptions, #rrors, &rogram #xceptions
7. 9.at is se"v0et t%nne00in&:.
Fsed in applet to servlet communications, a layer over http is built so as to enable object
serialiEation.
11.9.at is t.e -"onten) in Java:.A0so <.at is Bac$en):.
1rontend! pplet
Kackend ! 'racle, .s3ccess+Fsing J(KC,.
2/. 9.ic. o- t.e -o00o<in& att"ib%tes a"e co*p%0so"y <it. an Iapp0etJ ta&:.
code,height ; width.
21. 9.at )oes KCODEBASEK in an app0et ta& speci-y:.
1iles absolute path.
Access o)i-ie"sF Ahich gives additional meaning to data, methods and classes.
25. Too0s p"ovi)e) by JD;
+i, javac 3 compiler
+ii, java 3 interpretor
+iii, jdb 3 debugger
+iv, javap 3 (isassembles
+v, appletviewer 3 pplets
+vi, javadoc 3 documentation generator
+vii, javah 3 RCR header file generator
27.Hosti0e App0etsFIts an applet which when downloaded attempts to exploit your
systemRs resources in an inappropriate manner.It performs or causes you to perform an
action which you would not otherwise care to perform.
'8.(e*oteObGectsF 'bjects that have methods that can be called accross virtual
machines are 2emote 'bjects.n object becomes 2emote by implementing 2emote
Interface.
'1.Co*pi0in&F Conversion of &rogrammer3readable )ext into Kytecodes,which are
platform independent,is known as Compiling.
'2.Java 4"i*itive Data TypesF
Kyte3P3bit, short37[3bit, int3X83bit, 6ong3[W3bit, 1loat3X83bit floating point, (ouble3[W3
bit floating point, Char37[3bit Fnicode
''.9.at is a %nico)e:
Fnicode is a standard that supports International Characters.
'+. 9.at a"e b0oc$s:.
)hey are statements appearing within braces BD.
'/. 9.at a"e types o- Java app0ications:.
+i, 0tandalone applications+$o browser,.
+ii, pplets+Krowser,.
'1. 9.at is t.e *et.o) t.at &ets invo$e) -i"st in a stan) a0one app0ication:.
)he main+,method.
'3. 9.at is t."o<in& an E#ception:.
)he act of passing an #xception 'bject to the runtime system is called )hrowing an
#xception.
'5. 9.at a"e t.e pac$a&es in JD;:.
)here are P packages
+i, java.lang+ii,java.util+iii,java.io+iv,java.applet+v, java.awt
+vi, java.awt.image+vii,java.awt.peer+viii,java.awt.net
+8. 9.at is "%nnab0e:.
Its an Interface through which Java implements )hreads.)he class can extend from any
class but if it implements 2unnable,)hreads can be used in that particular application.
+1. 9.at is p"ee*ptive an) NonDp"ee*ptive Ti*e Sc.e)%0in&:.
&reemptive! 2unning tasks are given small portions of time to execute by using time3
slicing.
$on3&reemptive! 'ne task doesnRt give another task a chance to run until its finished or
has normally yielded its time.
+2. 9.at is sync."oni=ation:.
)wo or more threads trying to access the same method at the same point of time leads to
synchroniEation.If that particular method is declared as synchroniEed only one thread can
access it at a time. nother thread can access it only if the first threadRs task is complete.