0% found this document useful (0 votes)
114 views22 pages

Core Java Lab Manual

The document outlines a series of Java programming experiments conducted at Silver Oak University, each with specific aims such as calculating simple interest, evaluating arithmetic operations, and manipulating arrays. Each experiment includes a description, procedure, and references for further reading, along with post-practical questions. The content is structured to facilitate learning Java programming concepts through practical application.

Uploaded by

Harsh Vanpariya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views22 pages

Core Java Lab Manual

The document outlines a series of Java programming experiments conducted at Silver Oak University, each with specific aims such as calculating simple interest, evaluating arithmetic operations, and manipulating arrays. Each experiment includes a description, procedure, and references for further reading, along with post-practical questions. The content is structured to facilitate learning Java programming concepts through practical application.

Uploaded by

Harsh Vanpariya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ROAK

AKUNI
ERSIT Y DV SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION
EXPERIMENT NO: 1
Aim: Write a java program to evaluate simple Interest of agiven
Principal, rate, and time.

Description:
It shows basic feature of java class.

Procedure:
Steps:
public class Main
ublic stui oid

Systenout-ntln (C simele inteacst +s);

Qutrut
Simole Tntceti 3120,0

Page
10
sILVE
OAK
SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION

Conclusion:

References:
[1] https://www.javatpoint.com/Core Java-life-cvcle-of-activity
[2] https://www.geeksforgeeks.org/activity-lifecycle-in-Core Java-with-demo-app/

Post PracticalQuestions:
1. what is class?
Answer:
ckss ond methc
kluepriat

Page
12
Description:
Inthe below program you will see Arithmetic operators of java.

Procedure:

Steps: inpot aa chl. Somer


public Aithmeti_Qerutus

publrc sote muin. sting sc)


Genner (systrnin);
Sconner
hsle Chne
Systemout-printlh Eoter tao unbes

Systrn.out.qaint (C Choose oprotion to


2.Subg Toacin

5.Modue

it

Page
13
RSY SIL
UNIVERSITY
EDUCATION 'TOINNOVATION

Cese

mu;

Sylon out.pintta CMultiaication tmul)

batak
modí
mod= y
Sym,ut. grinthn modle;

Page
14
OAK UN

SILVER OA
UNIVERSIT
EDUCATION TO INNOVAT!
2

Choe ogcauton to perfrm


2.Subiuchon
S.Mode

Page
15
SILVER
ROAK
SILVER OAK
UNIVERSITY
EDUCATION TOINNOVATION

Conclusion:

References:
https://www.tutorialspoint.com/how-to-change-font-color-of-textview-in-Core Java
https://www.tutorialspoint.com/what-is-context-on-Core Java

Post Practical Questions:


1 List out arithmet ic operators.
Answer:

Page
16
SILVS
OAK UNI
SILVER OAK
UNIVERSITY
EDUCATION TOINNOVATION
EXPERIMENT NO: 3
Aim:Write a program to calculate the area of square and rectangle.

Description:

Procedure:
fmpot juja.uh. SanneN
Steps:
public class
publie stuhik

Sconner (Systmin
Sone

Sytn. oNt.pain CErter heiat

int

nt
Syst

Output Entts heigt ond


\O

Abca is:50

Page
17
SILVER
OAK
UNID SILVER OAK
UNIVERSITY
EDUCATION TOINNOVATION

Conclusion:

References:
https://www.javatpoint.com/Core Java-option-menu-example
|2] https://www.gecksforgeeks.org/how-to-impBenment-options-menu-in-Core Java/

Post Practical Questions:


1. Explain Toast class and option menmu?
Answer: Toast oss slayinahan
shot of
Ophion oethod Can be
sethag
dedete
Page
20
OAK UA
NID SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION

EXPERIMENT NO: 4
Alm write a program to input the 3 values from the user and display minimum using condition
operators.

Description:
Enter any three value and display smallest value using condition operator.

Procedure:

Steps:
JOva.sNN.til. Scanne
pubie doss
stahi void uinC
public
Stoner Sysiem i
Scasmess
no.1);
Sysen,aut. pintln C Enter
Systen.out-pint CEter no,2");

Systmout gint (Entkr no.3):

iot Smallest;

Gmallest 031

Page
21
SILVER
OAK UN
39 SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION

else

else Smallest35

Systn. aut.
Snelest

Conclusion:

References:
[1]
|2) https://www.javatpoint.com/Core Java-option-menu-example
https:/ wvww.gecksforgceks.org/how-to-implement-options-menu-in-Core Java/

Page
22
OAK UNN
RS SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION
EXPERIMENT NO: 5
Aim: WNrite a program to convert inches into centimetres.

Description:
Covert inches into centimeters using programming logiC.

Procedure:
Steps:

public class covert

Conw erson Cit inches


statie
dou'le Centimetrs
Ce ntiiner 2-54 inchess
Centimeter
Systn awtpintln C cestieBe

pulblic stuic main (stiny sc)


t inches 220;
ConversTon Cinches)

(eatine : S0,8

Page
23
VER
ROAK UN

SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION
EXPERIMENT NO: 6
Alm: Write aprogram to print even
numbers up to 10 using a while loop.

Description:
Display even number up to 10 number sing 10 while
loop.
Procedure:
Steps:
publte lass \oops
public

Systrmmut. qaintla CEven nubegs::

Sysknt qarintn Cx):

.Page
25
Steps:
Procedure:
Description:
Aim:
publcdas mpot
Display Write

puslie a
SILV
program
number OAK UN
intSystomsonnes îava,uil.
Sconne
even to
check
or
.aut.pintl odd EXPERIMENT
whether NO: 7
with
the the
INNOVATION
EDUCATION TO
SILVER
UNIVERSITY
scanner
OAK given
CSysenis);
CEnterSaner number
number.
is
even
ube:
or
odd.
even); Îs
OAK
SILVE
SILVEROAK
UNIVERSITY
EDUCATION TO INNOVATION

Qutput
een

Conclusion:

References:
|1 https://www.tutorialspoint.com/Core Java/Core Java animations. htm
|2] https://www.learnhowtoprogram.com/Core Java/introduction-to-Core
Java/introduction-to-xml-and-Core Java-lavouts
Page
28
OAKU
SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION

EXPERIMENT NO: 8
Aim: Writea Program to print Prime numbers
between 1to 100.
Description:
*Display prime number between 1 to 100.
Procedure:
Steps: class pinebexs

pubc Gtutie void main Cstng sÚ)

sting ine quoey -


fos Ci , i2-lo 0; i 4)

if Ci.Nun 0)

if Ccountes 2
(oinenunber prinenuber t14

Systun.out. pzinl Cqoinenunb,


Page
29
ROAKUNIVE

ERSIT SILVEROAK
UNIVERSITY
EDUCATION TOINNOVATION

Otat
eime unbes
2 3 11 13 1g 23 29 31 3?

23 3
S3 61 6

Conclusion

References:
https:/abhiCore Java.com/ui/chronometer/
|2| https://www.geeksforgeeks.org/chronometer-in-Core Java/

Page
30
ROAK
SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION

EXPERIMENT NO: 9
Aim:_Write aJAVAprogram to print the elements of an aray in reverse order.

Description:
Display any number in reverse order.

Procedure:
Steps
publie clas ReascAray
public stati vold main (s ing s)e

Systm.ut
fos Cint is 0; i<onnrlengthy itt

Systm out

Otpt
Oiginal anvy
1 9 3 45
Aruy
Page
3 21
31
SILVEA
OAK UN
SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION

EXPERIMENT NO: 10
AlMi write aJAVA program to sort the elements of an array in ascending order.

Description:
Display number in ascending order using array.
Procedure:
Steps:

publie class SortAtruy Exompe2


public statie vol muin Cstng s))
intt) 7s,34,1,3,30, 3, -1,, s20 ss;
Systnout.printa CAay ofter soting");
for Cint îe0; i<or leng itt)

int

orlj) tn
o):
Systn,out.qaintl (oa

Page
33
DAK
UN SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION

Otput
-65

20
34
34

qo

Conclusion:

References:
[1] https://abhiCore Java.com/ui/chronometer/
|2] https://www.geeksforgeeks.org/chronometer-in-Core Java/

Page
34
OAKU

SILVER OAK
UNIVERSITY
EDUCATION TO INNOVATION

EXPERIMENT NO: 11
Aim: Writejava Program to find reverse of
string
Description:
Display String in reverse order.
Procedure:
Steps:
public cass Reveose
pulolie stutie bid muin (st ha S)
sting stang Dreom abia
Sting geveascdStr

fox Cint i= stinglength )-1 j


TeveNed Ssh t Saing, chott ;

Systm.out.qanta C ongna sting + sting


Systten, ut.println

Revexse of e stiy gib moer

Page
35
OAKUN SILVER OAK
slTY: UNIVERSITY
EDUCATION TO INNOVATION

EXPERIMENT NO: 12

Aim: Write aJAVA program tocount the total number of characters in a string.

Description:
Display total number of characters in string.
Procedure:
Steps:
public clas Ccnt Chouctr
publ'e static void (sting s1)
Strng sting The best 6f both
iot count0

if Cstring. chorti))

gctm.aut. pnintln
Systm.t

Total chooucts: 3

Page
37
OAK
UNIVE SILVER OAK
UNIVERSITY
EDUCATION TOINNOVATION

EXPERIMENT NO: 13
Aim: Consideran employee class, which contains fields such as name and designation. And a
subclass, which contains a field salary. Write a program for inheriting this relation.

Description:
Display concept of inheritance. Take employee as parent class.
Procedure:

Steps:
class enp
public stning name n Ayush
shig deMonager 3
cas sal extends
public nt alany20000; 3
das
public stuhe void main CStaing agst)
Sal
Systm.aut. pnto C Name tSnomek

Sustnt-pritttn C say +sstloi

Qutput Name Ayh


Designatn: Monage
Salay 00o
Page
39

You might also like