Docsity

java final programing, Schemes and Mind Maps of Java Programming

Toggle sidebar
bg1
YUVAGURU COLLEGE OF ARTS AND SCIENCE
(Co-Education)
Kovilpalayam
Department of Computer Science and Applications
CORE LAB IV-JAVA PROGRAMMING
(For the Academic Year 2022-2023 - ODD Semester)
NAME : …....................................................................
REGISTER NO : ……………………………………………….
CLASS : ……………………………………………..
Certified Bonafide record of work done by
………………………………………………………………………………….
Staff-In-Charge Head of the Department
Submitted for the University Examination held on ……………………….
Internal Examiner External Examiner
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37

Partial preview of the text

Download java final programing and more Schemes and Mind Maps Java Programming in PDF only on Docsity!

YUVAGURU COLLEGE OF ARTS AND SCIENCE

(Co-Education)

Kovilpalayam Department of Computer Science and Applications CORE LAB IV-JAVA PROGRAMMING (For the Academic Year 2022- 2023 - ODD Semester) NAME : ….................................................................... REGISTER NO : ………………………………………………. CLASS : …………………………………………….. Certified Bonafide record of work done by …………………………………………………………………………………. Staff-In-Charge Head of the Department Submitted for the University Examination held on ………………………. Internal Examiner External Examiner

CONTENTS

S.No Date PARTICULARS Page No Signature 1 STRING EXTRACT 2 MULTIPLE INHERITANCE 3 EXCEPTION HANDLING 4 MULTITHREADING 5 SEVERAL SHAPES 6 MY DETAILS 7 MULTIPLE SELECTION LIST BOX 8 MULTILINE TEXT 9 MENU CREATION 10 MOUSE EVENT DISPLAY 11 SEVERAL SHAPES USING MOUSE 12 FILE PROCESS

1. STRING EXTRACT

class Stringextract { public static void main(String args[]) { String s1; s1=new String("WELCOME TO JAVA PROGRAMMING"); System.out.println("The given string is:"+ s1); System.out.println("The Extracted portion:" + s1.substring(10,16)); } }

OUTPUT:

The Given string is: WELCOME TO JAVA PROGRAMMING The Extracted portion: JAVA

2.MULTIPLE INHERITANCE

class Arith { int a,b; } interface Addition { void add(); } interface Subtraction { void sub(); } class Operation extends Arith implements Addition,Subtraction { public void add() { a=10+5; System.out.println("Addition value:"+ a);

public void sub() { b=20-10; System.out.println("Subtraction value:"+ b); } } class Interface { public static void main(String args[]) { Operation op=new Operation(); op.add(); op.sub(); } }

3. EXCEPTION HANDLING

import java.util.*; class Payout extends Exception { public static void main(String args[]) { Scanner s=new Scanner(System.in); System.out.println("Enter a Salary"); int salary=s.nextInt(); System.out.println("Enter a Days"); int days=s.nextInt(); try { int total=salary/days; if(total>3000) { throw new ArithmeticException("PAY OUT OF BOUNDS"); } System.out.println("Salary:"+ total);

OUTPUT:

Enter a Salary: 5000 Enter a Days: 30 Salary: Enter a Salary: 1000000 Enter a Days: 10 java.lang.ArithmeticException: PAY OUT OF BOUNDS

System.out.println(i+"2="+i2); } System.out.println("Thread B Exited"); } } class ThrC extends Thread { public void run() { System.out.println("Thread C started"); for(int i=1;i<=5;i++) { System.out.println(i+"3="+i3); } System.out.println("Thread C Exited"); } } class Priority

public static void main(String args[]) { ThrA a=new ThrA(); ThrB b=new ThrB(); ThrC c=new ThrC(); c.setPriority(1); b.setPriority(5); c.setPriority(10); a.start(); b.start(); c.start(); } }

5. SEVERAL SHAPES

Java file: import java.applet.; import java.awt.; public class Shapes extends Applet { public void paint(Graphics g) { g.drawString("Line",25,40); g.drawLine(60,60,150,60); g.drawString("Square",25,80); g.drawRect(60,90,90,90); g.drawString("Rectangle",25,200); g.drawRect(60,210,120,90); g.drawString("Circle",25,320); g.drawOval(60,330,90,90); g.drawString("Square",25,450); g.drawOval(60,460,120,90); }