Address
:
[go:
up one dir
,
main page
]
Include Form
Remove Scripts
Session Cookies
Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
21 views
12 pages
Java Lab Programs
Java lab manuals are in this pd thee are use full
Uploaded by
dilludhanush420
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Java lab programs For Later
Download
Save
Save Java lab programs For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
21 views
12 pages
Java Lab Programs
Java lab manuals are in this pd thee are use full
Uploaded by
dilludhanush420
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Java lab programs For Later
Carousel Previous
Carousel Next
Download
Save
Save Java lab programs For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 12
Search
Fullscreen
METHOD OVERLOADING 1, Write a program to find the Area of Square, Rectangle and Circle usingMethod Overloading. AIM To write a java program to find the Area of Square, Rectangle and Circle using Method Overloading ALGORITHM, STEP 1: Start the program. STEP 2: Create a class with main() method. STEP 3: Overload the method to calculate the area of square, rectangle and circle withinthe class. STEP 4: Create object for the class and call the methods. STEP 5:Stop the program. SOURCE COD! import java.io.*; class area { void calculateArea(float x) { System.out printin("Area of the Square: } void calculateArea(float x,float y) { System.out printin("Area of the rectangl t void calculateArea(double r) { double area=3.14*r*r; "axtxt" sq units"); ‘y+ sq units"); System.out printin("Area of the circle:"+area+" sq units"); + public static void main(String args(]) { area obj-new area(); obj.calculateArea(6.19); obj.calculateArea( 10,22); obj.calculateArea(6.1); } }RESULT: Thus the above program has been executed successfillly. OUTPU Tal C\Windons\systems2cmdexe i ee Gestrtancade com eee raccteots NEN Se Seer ee) eee eed cee ts ec Petey PEs oe mere ree Teena cevarttss Cras ere res cee ery mer atte cee ComeBANK DETAILS 4, Write a program to design a class to represent a bank account. Include the following: Data Members: Name of the depositor, Account number, Type of account, and Balance amount in theaccount, Methods: To assign initial values, To deposit an amount, Towithdraw an amount after checking balance, and To display the name and balance. AIM: To write a java program for bank operation ALGORITHM STEP 1: Start the program. STEP 2: Create a class with data member such as depositor name, account number, type of accountand balance amount STEP 3: Create Methods such as assign initial values, deposit, withdraw, balance checkingand display the details. STEP 4: Create an object for the class in main() method. STEP 5: Call the methods. STEP 6: Stop the program, SOURCE COD! import java.io.*; class Account { private String name; double balance = 0.0; Account(String name, double balance) { this.name = name; this.balance = balance; } public void deposit(double amount) t balance = balance + amount; } public void withdraw(double amount) { balance = balance - amount; + public void display() { System.out printIn("Name of the depositor:”+name);, System.out printin("Balance Amount:"+balance);public double getBalance(double balance) { return balance; public class Bank { public static void main(String{] args) { Account Ace = new Account("kausalya",8555); Account Acel = new Account("Devi",9000); Ace.deposit(200); Acc1.withdraw(300); Ace.displayQ); Accl.display(); RESUL' ‘Thus the above program has been executed suc OUTPUT: Tal C\Windons\systems2emdece Eng bind peNatSS EN ethene na ae Pe ea paren ee Seren ers oe Sie eteterer reyPACKAGE 5.Write a program that import the user defined package and access the Membervariable of classes that contained by Package. AIM: To write a java program that import the user defined package and access the Member variable of classes that contained by Package. ALGORITHM: STEP 1: Start the program. STEP 2: Create the user-defined package. STEP 3: Create the stack class with member variables. STEP 4: Create the methods for stack operations STEP 5: Create a program outside the package. STEP 5: Import the user-defined package. STEP 6: Create a class with main() method. STEP 7: Create an object to access the methods inside the user-defined package for stack operation. STEP 8: Stop the program. SOURCE CODE: /*Source code of package pl under the directory C:\jdk1.6.0_26\bin>p l\edit Student java */ package p1; public class Student { int regno; String name; public void getdata(int r,String s) public void putdata() t System.out.printIn("regno =" +regno); System.out printIn("name =" + name); } } /* Source code of the main function under C:\jdk1.6.0_26\bin>edit StudentTest,java */ import pl.*; class StudentTest { public static void main(String arg{]) t student s=new student(); s.getdata(123,"xyz"); s.putdataQ; } }Thus the above program has been executed successfilly. OUTPUT: Bl C\Windows\systems2cemdnce Ti ee Gator tancade com tere racorenretren re IEC E TTT SEEN CCT Eee Sete tae Ace aes ENO eee cobs ECCS eT Eee NC SES == aa)MULTITHREADI 7.Write a program to illustrate the use of multithreads. AIM: To write a java program to illustrate the use of multithreads. ALGORITHM. STEP 1: Start the program. EP 2: Create a class that inherits the Thread class. STEP 3: Override the run() method and execute the loop to display some value. STEP 4:Create a class with main() method. STEP 5: Create two objects for the thread class, STEP 6: Start thethread of the two objects. STEP 7: Stop the program. SOURCE COD! import java.io.*; class Thread3 extends Thread { public void runQ){ for(int H1:i<5:i+4) { try Thread sleep(500); }jeatch(InterruptedException e){ System. out printIn(e); } System. out printIn(i); t } publie statie void main(String args{]){ Thread} tl=new Thread3(); ‘Thread3 (2=new Thread3(); trun; 12.run(); } }RESULT: Thus the above program has been executed successfully OUTPUT: Bl C\Windows\sytems2\emeiene EPs TEE TED SNe ESE Ae EBE NESSTUDENT REGISTRATION FORM USING APPLET 8. Write a program to create student registration form using applet with ‘Name,Address, Sex, Class, Email id. AIM: To write an applet program for student registration form. ALGORITHM STEP 1: Start the program. STEP 2: Create a class that extends the Applet class. STEP 3: Create an object for TextField, Button, Checkbox and Label classes in the init() STEP 4: Override the actionPerformed() method to check and display the events, SOURCE CODE: + Tesjava import java.awt.*; public class Tes extends java.applet. Applet t public void init() { setLayout(new FlowLayout(FlowLayout. LEFT); add(new Label("Name ——:")) add(new TextField(10)); add(new Label("Address —:")); add(new TextField(10)); add(new Label("Birthday — :")); add(new TextField(10)); add(new Label("Gender —_:")); Choice gender = new Choice(); gender. addltemn("Man"); gender.additem("Woman"); ‘Component add = add(gender); add(new Label(""Iob "); CheckboxGroup job = new CheckboxGroup(); add(new Checkbox("'Student", job, false)); add(new Checkbox(""Teacher", job, false)); add(new Button("Register")); add(new Button("Exit")); }© Tes.html
Register
lass" width=230 height=300>
RESULT: Thus the above program has been OUTPUT: BB C\Windowa\systerar\emdoe aR UTEEY SCRE eerie: SEES Sistecar entre eet Mame Adares= Sintnday [7 So0S201S Gencaer [woman sop Stucent < VeacnerGRAPHICS METHOD 9. Write a program to draw the line, rectangle, oval, text using the graphics method. AL To write an applet program to display line, rectangle, oval and text using graphics method. ALGORITHM: STEP 1: Start the program. STEP 2: Create a class that extends Applet class. STEP 3: Override the pain() method. STEP 4: Call the method to display the line, rectangle, oval and text. STEP 4: Stop the program. SOURCE CODE: import java.awt.*; import java.applet.*;
1 public class Drawing extends Applet { public void paint(Graphies g) t g.drawL ine(10,10,50,50); g.drawRect(10,60,40,30); g.setColor(Color.green); g.fillRect(160,10,30,80); g.drawOval(220,20,200,120); g.setColor(Color.red); g.fillOval(220,170,150,100); g.setColor(Color.blue); g.drawString("SSNC", 10,275); I }RESULT: Thus the above program has been executed successfully OUTPUT: Bi C\Windows\system22\cmd.exe -appletviewer Drawingjava Parr SS Ce OS aT TSC eS ear r emery ES SOS ee eo eas ES ere ae ey 2 Applet Viener Drawing class Applet \ ey sane eppletstartoa
You might also like
Java Programming Lab Manual - NEP
PDF
100% (5)
Java Programming Lab Manual - NEP
27 pages
II_CS_-_JAVA_LAB
PDF
No ratings yet
II_CS_-_JAVA_LAB
31 pages
Java
PDF
No ratings yet
Java
4 pages
Practical Record Java 2021
PDF
No ratings yet
Practical Record Java 2021
42 pages
Durga Oops Through Java Lab Manual Programs (Cse)
PDF
No ratings yet
Durga Oops Through Java Lab Manual Programs (Cse)
52 pages
0_java Record Work 2020-2023-Semester III
PDF
No ratings yet
0_java Record Work 2020-2023-Semester III
25 pages
II BSC IT JAVA RECORD 2024 (1)
PDF
No ratings yet
II BSC IT JAVA RECORD 2024 (1)
51 pages
Java Lab Program With Aim & Algorithm
PDF
No ratings yet
Java Lab Program With Aim & Algorithm
47 pages
School of Computing Science: Practical Record
PDF
100% (1)
School of Computing Science: Practical Record
42 pages
Share Java Programs
PDF
No ratings yet
Share Java Programs
24 pages
Java Lab Programs JNTUA
PDF
No ratings yet
Java Lab Programs JNTUA
10 pages
Java Practical
PDF
No ratings yet
Java Practical
25 pages
Lab Manual
PDF
No ratings yet
Lab Manual
15 pages
Java Practical File Rohit
PDF
No ratings yet
Java Practical File Rohit
41 pages
Java Lab Manual 1
PDF
No ratings yet
Java Lab Manual 1
15 pages
OOPs & DS LAB Manual
PDF
No ratings yet
OOPs & DS LAB Manual
56 pages
BCA II Year Java Practical Solution
PDF
No ratings yet
BCA II Year Java Practical Solution
20 pages
Mca - Java Program Final
PDF
No ratings yet
Mca - Java Program Final
54 pages
Java Lab List
PDF
No ratings yet
Java Lab List
13 pages
Java Programs Final
PDF
No ratings yet
Java Programs Final
13 pages
Java Programs
PDF
No ratings yet
Java Programs
40 pages
Java Lab Programs
PDF
No ratings yet
Java Lab Programs
27 pages
s3bsc_fair_record
PDF
No ratings yet
s3bsc_fair_record
28 pages
Java Programming Lab: Part-A 1. Write A Java Program To Demonstrate Method Overloading
PDF
No ratings yet
Java Programming Lab: Part-A 1. Write A Java Program To Demonstrate Method Overloading
25 pages
SY Java Journal 2023 24
PDF
No ratings yet
SY Java Journal 2023 24
33 pages
Java Coding
PDF
No ratings yet
Java Coding
15 pages
Pre Selection Comp Project
PDF
No ratings yet
Pre Selection Comp Project
39 pages
Java Lab Programs 1.a. Write A Java Program To Demonstrate Constructor Overloading and Method Overloading
PDF
No ratings yet
Java Lab Programs 1.a. Write A Java Program To Demonstrate Constructor Overloading and Method Overloading
12 pages
Final JAVA PR Ans
PDF
No ratings yet
Final JAVA PR Ans
40 pages
Employee Processing - Using Class
PDF
No ratings yet
Employee Processing - Using Class
38 pages
Java Programming
PDF
No ratings yet
Java Programming
44 pages
Java Pratical Exam
PDF
No ratings yet
Java Pratical Exam
13 pages
r22 Java Prgmmg Lab Manual
PDF
No ratings yet
r22 Java Prgmmg Lab Manual
14 pages
PROGRAM
PDF
No ratings yet
PROGRAM
33 pages
19ucap05 - Java Programming Lab Final
PDF
No ratings yet
19ucap05 - Java Programming Lab Final
42 pages
JAVA
PDF
No ratings yet
JAVA
22 pages
BCSL-043 Lab Record
PDF
67% (3)
BCSL-043 Lab Record
21 pages
Java Programming LAB RECORD PDF
PDF
No ratings yet
Java Programming LAB RECORD PDF
21 pages
Document from ✨...?
PDF
No ratings yet
Document from ✨...?
47 pages
Untitled Document
PDF
No ratings yet
Untitled Document
6 pages
BCA - Java Lab File
PDF
No ratings yet
BCA - Java Lab File
35 pages
Java All Programs
PDF
No ratings yet
Java All Programs
15 pages
1151CS302 - Java Programming Lab
PDF
No ratings yet
1151CS302 - Java Programming Lab
33 pages
Part-B Java List 2023
PDF
No ratings yet
Part-B Java List 2023
11 pages
COMPLETE JAVA PROGRAM File
PDF
No ratings yet
COMPLETE JAVA PROGRAM File
40 pages
Java Lab Manual
PDF
No ratings yet
Java Lab Manual
51 pages
Practical Assignment 2
PDF
No ratings yet
Practical Assignment 2
8 pages
JAVA PRACTICAL
PDF
No ratings yet
JAVA PRACTICAL
39 pages
Java Record
PDF
No ratings yet
Java Record
49 pages
1 (A) - Method Overloading Source Code
PDF
No ratings yet
1 (A) - Method Overloading Source Code
26 pages
2023winter
PDF
No ratings yet
2023winter
13 pages
JAVA PR
PDF
No ratings yet
JAVA PR
19 pages
Oops Lab
PDF
No ratings yet
Oops Lab
22 pages
Java Practical File
PDF
No ratings yet
Java Practical File
47 pages
Solutions Exam Questions Set 1 CSC2106 Object-Oriented Design & Programming
PDF
No ratings yet
Solutions Exam Questions Set 1 CSC2106 Object-Oriented Design & Programming
13 pages
JAVA LAB PROGRAMS SEM-3 NEP 1-12 (3)
PDF
No ratings yet
JAVA LAB PROGRAMS SEM-3 NEP 1-12 (3)
9 pages
182196-1739335271-Grade_VIII-_Study_Material-_Java_2
PDF
No ratings yet
182196-1739335271-Grade_VIII-_Study_Material-_Java_2
16 pages
Java Record2
PDF
No ratings yet
Java Record2
23 pages
JAVA Practical File
PDF
No ratings yet
JAVA Practical File
97 pages