Java Pyq Edited
Java Pyq Edited
eter?
Java program stored in
ytecode is independent
s the bytecode to native
2014-5
5 uéually provides
However, if it does
your answer with suitah),
o ®s5)
are used to initialize object;
they are called or invokeg
plicitly. Constructors have p,
er, the default construct,
one constructor, which i
then default constructo
:;i :l‘:fl':h
s ex!it,s',‘?
A ? N itmeis assigned to str.
having So basically
different both Kloeations)
references the objects “Hell-;fl0 Worlgr,,
ingBufl
xample,
a thread is born,
ete. life cycle of a thread.
written in Java.
f restrictions to protect the
equire talking to a
e, or computing the
foer
et.InetAddress
END TERM EXAMINA TON [JUNE-2015]
FOURTH SEMESTER [BCA|
OGR
i MM :75
is compulsory.
n example to each
(5%5=25)
when you want to process only
stener interface. You can define
S and_unple;nent only those events
, MousePressed etc.
y Anested class has access
it is nested. however
ted class.
nembers of
Provide
e complete life cycle of thread.
hread. (6.5
gram
e path followed when executing a pro
teq
, known as the main thread, which is crea
main() method is invoked with the main
a Thread:
cycle. For exgmple, a thread is born,
e use of
am to illustratthe
I @
streamis an abstractiont
to a physical deviceby
LP. University-(BCA|-Akash Books 2018611
tion; reads and returns the next byte from the stre
am
[OException; returns the number of bytes that
can be
i ) .
tes on any two o! f the following:
ing: i(6.25 x 2 - 1 |
)
Q‘i8. :v?;)east:(g):::)s
a and TCP/IP : based
. client
A andkst:rver socke
2ns Client and Sever communication using Socke
i dpoint of a two-way communi ication link betw£ een two progr
the TOP Lres a
rumfi\nsg CoI:f:.\:: :2:\5315 A socket is bound to a port nutn:ber 50 thal yer
identify the application that data is destined to be sent to.
Connection
g request
S P -
t °l ciient
It
R
p Connection
Server| © |
: g
r| Client
(t |
Working of Client
and Server using
Server runs on a specific Sockets
number. The server computer and has a
Just waits, listening socket that is bound to a specific
request. to the socket for a client p
to make a connectj
On the client-side:
serveris The client knows the
ing and the Port number hostname of the machine
request, the client on which the server on which t
tries to co is listening. To make a connectj
i
i
3 = source
i
re type 4 dfive’:lsplemented
for 3
’ [MAY-JUNE 2016]
‘n:n'fi R [B CA]
AING [BCA-206)
the unreferenced
we don’t need
Y%
2016-7
(2.5)
t places (pushes) the details of each method it
with details such as the name of the class/
(4.5)
v ke)vvord is used
xception and
MWBOM-AB Publisher 2016-9
Programming
Fourth Semesterter,, Java
102016 :
th e t op, botto m, left and right inge
bject that contains bty
method to get the Inset 0 ov er rride
ri c the getInset() method, v, "
aine r is di sp la ye d. We ha ve thy ,
used when the cont desire.
that cont ains the inset spacing you
Insets object ttom, g
left, int bottom, int right) top, l.efl., bo oy, ny
Constructor: Inset(int top, int and its en cl os in g Wi nd
etween the container
right specify the amount of space b
CardLayout layg,
ardLayout we can prepare different
It stores the different layouts. Using Ci
d when needed.
and have them hidden, ready to be activate
Constructors
CardLayout()
CardLayout(inthorz, intvert)
horizontal and vertj,
First one is default. Second one allows you to specify the
space left between components.
l. This pay
The object of CardLayout class is created and stored in the type Pane
must have CardLayout selected as its Layout manager.
CardLayoutcard_layout = new CardLayout();
Panel panel_main =new Panel();
ut);
panel_main.setLayout(card_layo
‘We can create different panels, each having a different set of components, th
these panels are added to the panel for which CardLayout is the layout manager. Final
the panel is added to the main applet panel.
Q.5. (c) List the methods under Window Listencr Interface. (
Ans.
;lx'lttqn entirely in
are more efficicnt
v (? irom String
W)
Fourth Semester, Java Programming
Ali streams behave in the same manner, even if the actua) phy,
ey are linked differ. Thus, the same 1/0 classes and methodg ci‘t
“device. This means that an input stream can abstracy,
a disk file, a keyboard or a network socket, Likewi‘: