PRACTICAL :1 AIM : write a program to print “Hello world !!! Welcome to Java” PROGRAM: class P1 { public static void main(String args[]) { System.out.println("Hello World!!"); System.out.println("Welcome to Java"); } } Output: PRACTICAL:2 AIM: write a program that declare a one integer variable called var1.give value 10 to this variable and using println statement, display the value on the screen like this “the value of var1 = 10” PROGRAM class P2 { public static void main(String args[]) { int var1=10; System.out.println("The value of var1 is" + " " +var1); } } OUTPUT: PRACTICAL :3 AIM : write a program to calculate the value of the following expression 1) 5%3+1 2) 5/3+1 3) 5*3+1 PROGRAM: class P3 { public static void main(String args[]) { int a,b,c; a=(5%3)+1; b=(5/3)+1; c=(5*3)+1; System.out.println("a:" + a); System.out.println("b:" + b); System.out.println("c:" + c); } } OUTPUT: PRACTICAL :4 AIM: write a program which shows the use of arithmetic operation. Note: take two int variable a, b where a=20 and b=10. PROGRAM : class P4 { public static void main(String args[]) { int a=20,b=10; System.out.println("Addition:" + (a+b)); System.out.println("Subtraction:" + (a-b)); System.out.println("Division:" + (a/b)); System.out.println("Multiplication:" + (a*b)); System.out.println("Modulus:" + (a%b)); } } OUTPUT: PRACTICAL:5 AIM: write a program which show use of relational operators. Note: take two int variable a,b where a=20,b=10. PROGRAM: class P5 { public static void main(String args[]) { int a=10,b=20; System.out.println("equal="+(a==b)); System.out.println("not equal="+(a!=b)); System.out.println("less than="+(a<b)); System.out.println("greater than="+(a>b)); System.out.println("less than equal to="+(a<=b)); System.out.println("greater than equal to="+(a>=b)); } } Output: PRACTICAL :6 AIM: write a program which show the use of bitwise operators. PROGRAM: class P6 { public static void main(String args[]) { int x=2,y=3; System.out.println("Bitwise &:" + (x&y)); System.out.println("Bitwise |:" + (x|y)); System.out.println("Bitwise ^:" + (x^y)); System.out.println("Bitwise ~:" + (~x)); System.out.println("Bitwise <<:" + (x<<1)); System.out.println("Bitwise >>:" + (x>>2)); System.out.println("Bitwise >>>:" + (x>>>1)); } } Output: PRACTICAL :7 AIM: write a program which find max and min number using turnery operator. PROGRAM: class P7 { public static void main(String args[]) { int a=20,b=10,Max,Min; Max=(a>b)?a:b; System.out.println("Max is :" + Max); Min=(a<b)?a:b; System.out.println("Min is :" + Min); } } OUTPUT : PRACTICAL:8 AIM : write a program which shows the use of increment and decrement operators operators. PROGRAM: class P8 { public static void main(String args[]) { int a=20,b=20,c=20,d=20; int posti,prei,postd,pred; posti=a++; System.out.println("post increment="+posti); prei=++b; System.out.println("pre increment="+prei); postd=c--; System.out.println("post decrement="+postd); pred=--d; System.out.println("pre decrement="+pred); } } Output: PRACTICAL:9 AIM: write a program to change whether the given student is pass or fail using if else statement. PROGRAM class P9 { public static void main(String args[]) { int marks=78; if(marks>35) { System.out.println("Passed"); } else { System.out.println("Failed"); } } } Output: PRACTICAL :10 AIM : write a program to check the given student class is distinction,1st class,2nd class,pass,fail using if else ladder or multiple if else statement. PROGRAM: class P10 { public static void main(String args[]) { int marks=78; if(marks>=70) { System.out.println("Distinction"); } else if(marks>=60 && marks<=69) { System.out.println("First class"); } else if(marks>=51 && marks<=59) { System.out.println("Second class"); } else if(marks>=35 && marks<=49) { System.out.println("passed"); } else { System.out.println("Failed"); } } } OUTPUT PRACTICAL :11 AIM: write a java application which show the use of switch statement. PROGRAM class P11 { public static void main(String args[]) { char ch='A'; switch(ch) { case 'A':System.out.println("monday"); break; case 'B':System.out.println("tuesday");; break; case 'C':System.out.println("wednesday"); break; case 'D':System.out.println("thursday"); break; case 'E':System.out.println("friday"); break; case 'F':System.out.println("saturday"); break; case 'G':System.out.println("sunday"); break; default:System.out.println("Invalid"); break; } } } OUTPUT : PRACTICAL : 12 AIM : write a program to generate first 10 number using while statement. PROGRAM class P12 { public static void main(String args[]) { int i=1; while(i<=10) { System.out.print(i + "\t" ); i++; } } } OUTPUT : PRACTICAL : 13 AIM : write write a program to generate first 10 number using do while statement. PROGRAM class P13 { public static void main(String args[]) { int i=1; do { System.out.print(i + "\t" ); i++; }while(i<=10); }} OUTPUT PRACTICAL: 14 AIM : write a program to generate first 10 numbers using for loop. PROGRAM class P14 { public static void main(String args[]) { int i; for(i=1;i<=10;i++) { System.out.print(i + "\t"); } } } OUTPUT : PRACTICAL :15 AIM : write a java application which shows the use of break statement. PROGRAM class P15 { public static void main(String args[]) { int i; for(i=1;i<=20;i++) { System.out.print(i + "\t"); if(i==10) { break; } } } } OUTPUT : PRACTICAL :16 AIM : Write a program which shows use of math class. PROGRAM: import java.lang.Math; class P16 { public static void main(String args[]) { int a=2,b=4,c=-10; double d=13.01; System.out.println("The Power of " + a + " is " + Math.pow(a,b)); System.out.println("Sqrt of " + b + " is " + Math.sqrt(b)); System.out.println("Maximum :" + Math.max(a,b)); System.out.println("Minimum :" + Math.min(a,b)); System.out.println("The ceil value of " + d + " is " + Math.ceil(d)); System.out.println("The floor value of " + d + " is " + Math.floor(d)); System.out.println("The round value of " + d + " is " + Math.round(d)); System.out.println("The absolute value of " + c + " is " + Math.abs(c)); } } OUTPUT : PRACTICAL :17 AIM : write a program to swap the value of two variables. PROGRAM class P17 { public static void main(String args[]) { int a=5; int b=3; int temp; System.out.println("the swapping is"); temp=a; a=b; b=temp; System.out.println("a:" + a + "\t" + "b:" + b); } } OUTPUT : PRACTICAL :18 AIM : write a program to find max of three number using nested if statement. PROGRAM: class P18 { public static void main(String args[]) { int a=5; int b=3; int c=10; if(a>b) { if(a>c) { System.out.println(a + " is maximum"); } else { System.out.println(c + " is maximum"); } } else { if(b>c) { System.out.println(b + " is maximum"); } else { System.out.println(c + " is maximum"); } } } } OUTPUT: PRACTICAL :19 AIM : write a program to generate the following Fibonacci series 0,1,1,2,3,5,8. PROGRAM class P19 { public static void main(String args[]) { int i; int a=0; int b=1; int c=1; System.out.print(+a + "\t"); for(i=0;i<6;i++) { System.out.print(+c + "\t"); c=a+b; a=b; b=c; } } } OUTPUT : PRACTICAL :20 AIM: write a program to find reverse of given number. PROGRAM class P20 { public static void main(String args[]) { int r; int sum=0; int n=123; do { r=n%10; sum=(sum*10)+r; n=n/10; }while(n>0); System.out.println("reverse="+sum); } } Output: PRACTICAL :21 AIM: write a program to check given number is Armstrong or not. PROGRAM class P21 { public static void main(String args[]) { int sum=0; int num=123,r,temp; temp=num; while(num>0) { r=num%10; sum=sum+(r*r*r) ; num=num/10; } if(num==sum) { System.out.println("Armstrong"); } else { System.out.println("Not Armstrong"); } } } OUTPUT : PRACTICAL :22 AIM : write a program to check number is prime or not. PROGRAM class P22 { public static void main(String args[]) { int count=0,i,num=2; for(i=1;i<=num;i++) { if(num%i==0) { count++; } } if(count==2) { System.out.println("Prime"); } else { System.out.println("Not Prime"); } } } OUTPUT : PRACTICAL :23 AIM: write a program to check whether the number is palindrome or not. PROGRAM class P23 { public static void main(String args[]) { int num=121; int r,sum=0,temp; temp=num; while(num>0) { r=num%10; sum=(sum*10)+r; num=num/10; } if(temp==sum) { System.out.println("Palindrome"); } else { System.out.println("Not Palindrome"); } } } Output: PRACTICAL :24 AIM : write a program to find the factorial of given number. PROGRAM class P24 { public static void main(String args[]) { int f=1; int n=5; do { f=f*n; n--; }while(n>0); System.out.println("factorial="+f); } } OUTPUT: PRACTICAL :25 AIM : write a program to generate following triangles. PROGRAM 1) class P25_1 { public static void main(String args[]) { int i,j; for(i=1;i<=4;i++) { for(j=1;j<=i;j++) { System.out.print(j ); } System.out.print("\n"); } } } OUTPUT : (2) class P25_2 { public static void main(String args[]) { int i,j; for(i=1;i<=4;i++) { for(j=1;j<=i;j++) { System.out.print(i); } System.out.print("\n"); } } } OUTPUT : 3) class P25_3 { public static void main(String args[]) { int i,j; for(i=5;i>=0;i--) { for(j=1;j<=i;j++) { System.out.print(j); } System.out.print("\n"); } } } Output: PRACTICAL :26 AIM:Write a program to insert 5 elements into one dimensional arrays & display them. PROGRAM class P26 { public static void main(String args[]) { int a[]={1,2,3,4,5}; int i; for(i=0;i<5;i++) { System.out.print(a[i] + "\t"); } } } OUTPUT : PRACTICAL :27 AIM:Write a program to display following matrix using two dimensional arrays: 10 20 30 40 50 60 70 80 90 PROGRAM class P27 { public static void main(String args[]) { int a[][]=new int[3][3]; int i,k=0,j; for(i=0;i<3;i++) { for(j=0;j<3;j++) { a[i][j]=k+10; System.out.print(a[i][j] + "\t"); k=k+10; } System.out.println(); } } } OUTPUT PRACTICAL :28 AIM :Write a program for Additon of Two 3*3 matrix. PROGRAM class P28 { public static void main(String args[]) { int a[][]={ {1,2,3},{4,5,6},{7,8,9}}; int b[][]={{1,2,3},{4,5,6},{7,8,9}}; int c[][]=new int[3][3]; int i,j; for(i=0;i<3;i++) { for(j=0;j<3;j++) { c[i][j]=a[i][j]+b[i][j]; System.out.print(c[i][j] + "\t"); } System.out.println(); } } } OUTPUT : PRACTICAL :29 AIM :Write a program to find sum & average of 5 numbers using one dimensional array. PROGRAM class P29 { public static void main(String args[]) { int a[]={1,2,3,4,5}; int i,sum=0; double avg; for(i=0;i<5;i++) { sum=sum+a[i]; } avg=sum/5; System.out.println("Sum :" + sum); System.out.println("avg :" + avg); } } Output: PRACTICAL :30 AIM: write a program to display the details of student using class and object not initialize roll no=150702 and name=JAVA. PROGRAM class Student { int rollno; String name; void display() { System.out.println("ROLL NO="+rollno); System.out.println("NAME="+name); } } class P30 { public static void main(String args[]) { Student s=new Student(); s.display(); } } Output: PRACTICAL :31 AIM : Write a program to display details of student using class and object. PROGRAM class Student { int rollno=150702; String name="JAVA"; void display() { System.out.println("ROLL NO="+rollno); System.out.println("NAME="+name); } } class P31 { public static void main(String args[]) { Student s=new Student(); s.display(); } } OUTPUT : PRACTICAL :32 AIM : Write a program to initialize student details using default constructor using the same. PROGRAM class Student { int rollno; String name; Student() { rollno=150702; name="JAVA"; } void display() { System.out.println("ROLL NO="+rollno); System.out.println("NAME="+name); } } class P32 { public static void main(String args[]) { Student s=new Student(); s.display(); } } OUTPUT : PRACTICAL :33 AIM :Write a program to initialize student details using parameterized constructor using the same. PROGRAM class Student { int rollno; String name; Student(int a,String b) { rollno=a; name=b; } void display() { System.out.println("ROLL NO="+rollno); System.out.println("NAME="+name); } } class P33 { public static void main(String args[]) { Student s=new Student(150702,"JAVA"); s.display(); } } OUTPUT PRACTICAL :34 AIM : Write a java application that implements constructor overloading. PROGRAM class Rect { int l,b; Rect() { l=10; b=20; } Rect(int x,int y) { l=x; b=y; } void area() { System.out.println("AREA:" + (l*b)); } } class P34 { public static void main(String args[]) { Rect r1=new Rect(); r1.area(); Rect r2=new Rect(2,3); r2.area(); } } OUTPUT : PRACTICAL :35 AIM : Write a program to create a class with constructor and method to calculate area of circle. PROGRAM class Circle { int r; Circle() { r=10; } Circle(int x) { r=x; } void area() { System.out.println("AREA:" + (3.14*r*r)); } } class P35 { public static void main(String args[]) { Circle c1=new Circle(); c1.area(); Circle c2=new Circle(2); c2.area(); } } OUTPUT : PRACTICAL :36 AIM : Explain the working of equals and compare to method of string class using program. PROGRAM class P36 { public static void main(String args[]) { String s1=new String("Welcome To Java"); String s2="Welcome To Java"; String s3="Welcome To C"; System.out.println(s1.equals(s2)); System.out.println(s2.equals(s3)); System.out.println(s1.compareTo(s3)); } } OUTPUT PRACTICAL :37 AIM : Explain the working of region match method of string class using program. PROGRAM class P37 { public static void main(String args[]) { String s1=new String("Welcome To Tutorialspoint.com"); String s2=new String("Tutorials"); String s3=new String("TUTORIALS"); System.out.println(s1.regionMatches(11,s2,0,9)); System.out.println(s1.regionMatches(11,s3,0,9)); System.out.println(s1.regionMatches(true,s11,s2,0,9)); } } OUTPUT PRACTICAL :38 AIM : Explain the working of end with method of string class using program. PROGRAM class P38 { public static void main(String args[]) { String s=new String("Welcome To Java"); boolean a,b; a=s.endsWith("Java"); b=s.endsWith("Ja"); System.out.println(a); System.out.println(b); } } OUTPUT PRACTICAL :39 AIM: Explain the working of start with method of string class using program. PROGRAM class P39 { public static void main(String args[]) { String s=new String("Welcome To Java"); boolean a,b; a=s.startsWith("Welcome"); b=s.startsWith("Java"); System.out.println(a); System.out.println(b); } } OUTPUT PRACTICAL :40 AIM : Explain the working of length,concat and char at method of string class using program. PROGRAM class P40 { public static void main(String args[]) { String s1=new String("Hello"); String s2=new String("Hi"); System.out.println("Length Of String S1:" + s1.length()); System.out.println("Index Of String S1:" + s1.charAt(2)); System.out.println("Concate Of String S2:" + s1.concat(s2)); } } OUTPUT PRACTICAL :41 AIM : Explain the working of sub string method of string class using program. PROGRAM class P41 { public static void main(String args[]) { String s="Welcome To Java"; System.out.println(s.substring(0,11) + "Html"); } } OUTPUT PRACTICAL :42 AIM : Explain the working of to lower bit,to upper bit,trim,replace first,replace all method of string class using program. PROGRAM class P42 { public static void main(String args[]) { String s1="Welcome"; String s2=" Hello"; System.out.println(s1.toLowerCase()); System.out.println(s1.toUpperCase()); System.out.println(s2.trim()); System.out.println(s1.replace('W','A')); System.out.println(s1.replaceFirst("W","Abc")); System.out.println(s1.replaceAll("Welcome","Svbit")); } } OUTPUT PRACTICAL :43 AIM : Explain the working of split method using program. PROGRAM class P43 { public static void main(String args[]) { String a[]="Java,C?C#,C++".split("[.,:,;,?]"); for(int i=0;i<a.length;i++) System.out.println(a[i]); } } OUTPUT PRACTICAL :44 AIM: Explain the working of string matching method using program. PROGRAM class P44 { public static void main(String args[]) { String s=new String("Welcome To Tutorials.com"); System.out.println(s.matches("(.*)Tutorials(.*)")); System.out.println(s.matches("Tutorials")); System.out.println(s.matches("Welcome(.*)")); } } OUTPUT PRACTICAL :45 AIM : Explain the working of index of method using program. PROGRAM class P45 { public static void main(String args[]) { String s=new String("Welcome To Java"); System.out.println(s.indexOf('l')); System.out.println(s.indexOf('o')); System.out.println(s.indexOf("come")); } } OUTPUT PRACTICAL :46 AIM: Explain the working of char value,comapare to,equals,islater or digit,is lowercase,is uppercase method of character class using program. PROGRAM class P46 { public static void main(String args[]) { Character c=new Character('a'); System.out.println(c.charValue()); System.out.println(c.compareTo(new Character('a'))); System.out.println(c.compareTo(new Character('b'))); System.out.println(Character.isLetterOrDigit('o')); System.out.println(Character.isLetter('g')); System.out.println(Character.isLowerCase('A')); System.out.println(Character.isUpperCase('A')); } } OUTPUT PRACTICAL :47 AIM: Explain the working of append, insert, delete, deleteCharAt , Reverse , replace , SetCharAt methods of String buffer class or String builder class PROGRAM class P47 { public static void main(String ar[]) { String s; int a=42; StringBuilder string1=new StringBuilder(40); StringBuilder string=new StringBuilder("welcome to java"); s=string1.append("Welcome").append(" to").append(" Earth..!!").toString(); System.out.println(s); string.insert(11,"HTML & "); System.out.println(string); string.delete(8,11); System.out.println(string); string.deleteCharAt(8); System.out.println(string); string.replace(11,15,"HTML"); System.out.println(string); string.reverse(); System.out.println(string); string.setCharAt(0,'@'); System.out.println(string); } } OUTPUT : PRACTICAL : 48 AIM:: Explain the working of Capacity & Length method of string buffer class PROGRAM : class P48 { public static void main(String ar[]) { StringBuffer s=new StringBuffer("Java"); System.out.println("Length : "+s.length()); System.out.println("Capacity : "+s.capacity()); } } OUTPUT : PROGRAM :49 AIM: Write a program to convert String "Great" to new String "God" using String buffer class PROGRAM class P49 { public static void main(String ar[]) { StringBuffer s=new StringBuffer("Great"); s.setCharAt(1,'o'); s.setCharAt(2,'d'); s.setLength(3); System.out.println("New String is="+s); } } OUTPUT : PRACTICAL : 50 AIM : Write a program to use this keyword to refer the current class parameterize constructer & current class instance variable PROGRAM class abc { String word; abc() { this("Welcome to my world..!!"); this.display(); } abc(String word) { this.word=word; } void display() { System.out.println(""+word); } } class P50 { public static void main(String ar[]) { abc s=new abc(); } } OUTPUT : PRACTICAL-51 AIM: Write a java application to create a class method with same name but different signature. (Note: Use the concept of method overloading dynamic polymorphism.) PROGRAM: class S1 { int x,y; void add(int a, int b) { int c; c=a+b; System.out.println("Addition is: "+c); } } class S2 extends S1 { void add(int a , int b ,int c) { int d=a+b+c; System.out.println("Addition is :"+d); } } class P51 { public static void main(String arr[]) { S1 obj1=new S1(); obj1.add(10,20); S2 obj2=new S2(); obj2.add(10,20,30); } } OUTPUT: PRACTICAL-52 AIM: Write a java application that contains super and sub class with same name and same signature (Note: use the concept of method overriding.) PROGRAM: class S1 { int x,y; void add(int a,int b) { int c=a+b; System.out.println("Addition is: "+c); } } class S2 extends S1 { void add(int a, int b) { int c= a+b; System.out.println("Additiom is:"+c); } } class P52 { public static void main(String arr[]) { S1 obj1=new S1(); S2 obj2=new S2(); obj1.add(10,20); obj2.add(20,40); } } OUTPUT: PRACTICAL : 53 AIM: write a program to illustrate static polymorphism. PROGRAM class P { static void disp() { System.out.println("p"); } } class Q extends P { static void disp() { System.out.println("q"); } } class P53 { public static void main(String args[]) { P.disp(); Q.disp(); } } OUTPUT : PRACTICAL-54 AIM: Write a java application for abstract class using abstract method of the class. PROGRAM: abstract class Figure { double dim1; double dim2; Figure(double a, double b) { dim1=a; dim2=b; } abstract double area(); } class Rectangle extends Figure { Rectangle(double a,double b) { super(a,b); } double area() { System.out.println("Inside area :"); return dim1*dim2; } } class Triangle extends Figure { Triangle(double a, double b) { super(a,b); } double area() { System.out.println("Inside area :"); return dim1*dim2/2; } } class P54 { public static void main(String arr[]) { Rectangle r=new Rectangle(9,5); Triangle t=new Triangle(10,8); System.out.println("Area is "+r.area()); System.out.println("Area is "+t.area()); } } OUTPUT: PRACTICAL : 55 AIM: write a program to create person class which contain general details of person and create sub class which contain company details. PROGRAM class Person { String name; int age; void details(String name,int age) { this.name=name; this.age=age; } void get_details() { System.out.println("Name:" + name); System.out.println("Age:" + age); } } class Employee extends Person { int id; String cName; String cAddr; Employee(int id,String name,int age,String cName,String cAddr) { this.id=id; details(name,age); this.cName=cName; this.cAddr=cAddr; } void get_empDetails() { System.out.println("Id:" + id); get_details(); System.out.println("Company Name:" + cName); System.out.println("Company Address:" + cAddr); } } class Pro55 { public static void main(String args[]) { Employee e=new Employee(1,"Java",50,"SunMicro","Us"); e.get_empDetails(); } } OUTPUT : PRACTICAL :56 AIM: write a program to illustrate the order of calling of default constructor in super class. PROGRAM class A { A() { System.out.println("Super class Constructor called"); } } class B extends A { B() { System.out.println("Sub class Constructor called"); } } class Pro56 { public static void main(String args[]) { B b=new B(); } } OUTPUT : PRACTICAL-57 AIM: Write a java application using super keyword to access super class variables & parameterized constructor. PROGRAM: class A { int x; A(int x) { this.x=x; } void show() { System.out.println("Superclass method"+x); } } class B extends A { int y; B(int a,int b) { super(a); y=b; } void show() { super.show(); System.out.println("y="+y); System.out.println("super x="+super.x); } } class P57 { public static void main(String arr[]) { B obj1=new B(10,24); obj1.show(); } } OUTPUT : PRACTICAL : 58 AIM : write a program to convert one class type into another class type PROGRAM class One { void show1() { System.out.println("One's method"); } } class Two extends One { void show2() { System.out.println("Two'smethod"); } } class P58 { public static void main(String arr[]) { One obj1=new One(); obj1.show1(); Two obj2=new Two(); obj2.show1(); obj2.show2(); One obj3=(One) new Two(); obj3.show1(); Two obj4=(Two) new One(); obj4.show1(); obj4.show2(); One obj5=(One) new Two(); Two obj6=(Two) obj5; obj6.show1(); obj6.show2(); } } OUTPUT : PRACTICAL : 59 AIM : write a program which show the use of instance of operator PROGRAM public class P59 { public static void main( String arg[]) { P59 DemoObj=new P59(); if (DemoObj instanceof P59) { System.out.println(" DemoObj is a instance of demo class"); } else { System.out.println(" DemoObj is not a instance of demo class"); } } } OUTPUT : PRACTICAL : 60 AIM : write a program related to interface .(note : use name of interface SHAPE) PROGRAM interface Shape { void area(); void volume(); double pi=3.14; } class Circle implements Shape { double r; Circle(double radius) { r=radius; } public void area() { System.out.println("Area os a circle is :"+pi*r*r); } public void volume() { System.out.println("Volume of a rectangle is :"+2*pi*r); } } class Rectangle implements Shape { double l,b; Rectangle(double length,double breadth) { l=length; b=breadth; } public void area() { System.out.println("Area of a reactangle is " +l*b); } public void volume() { System.out.println("Volume of a rectangle :"+2*(l+b)); } } class P60 { public static void main(String arr[]) { Circle ob1=new Circle(10.2); ob1.area(); ob1.volume(); Rectangle ob2=new Rectangle(12.6,23.55); ob2.area(); ob2.volume(); } } OUTPUT : PRACTICAL : 61 AIM : write a program related to interface .(note : use name of interface CALCULATOR) PROGRAM interface Calculator { int add(int a,int b); int subtract(int a,int b); int multiply(int a,int b); int divide(int a,int b); } class P61 implements Calculator { public int add(int a,int b) { return a+b; } public int subtract(int a,int b){ return a-b; } public int multiply(int a,int b){ return a*b; } public int divide(int a,int b){ return a/b; } public static void main(String args[]){ P61 c=new P61(); System.out.println("Value after addition = "+c.add(5,2)); System.out.println("Value after Subtraction = "+c.subtract(5,2)); System.out.println("Value after Multiplication = "+c.multiply(5,2)); System.out.println("Value after division = "+c.divide(5,2)); }} OUTPUT : PRACTICAL : 62 AIM : write a program to illustrate how to achieve multiple inheritance using interface PROGRAM interface Father { double PROPERTY=10000; double HEIGHT=5.6; } interface Mother { double PROPERTY=30000; double HEIGHT=5.4; } class Myclass implements Father,Mother { void show() { System.out.println("Total Property is:"+(Father.PROPERTY+Mother.PROPERTY)); System.out.println("Average height is:"+(Father.HEIGHT + Mother.HEIGHT)/2); } } class P62 { public static void main(String arr[]) { Myclass obj1= new Myclass(); obj1.show(); } } OUTPUT : PRACTICAL : 63 AIM : 1- Write a program to create package “PACK” and insert addition and subtraction class into Package “PACK” 2-Write a program to show use of addition and subtraction class from Package “PACK”. PROGRAM PRACTICAL : 64 AIM : write a program to show how to create sub package into package. PROGRAM PRACTICAL : 65 AIM : write a program to show the use of file input Stream class. PROGRAM PRACTICAL : 66 AIM : write a program to show the use of file output Stream class. PROGRAM PRACTICAL : 67 AIM : write a program to show the data input and data output of Stream class. PROGRAM PRACTICAL : 68 AIM : write a program to show the buffer input and buffer output of Stream class. PROGRAM PRACTICAL : 69 AIM : write a program related to random access file class. PROGRAM PRACTICAL : 70 AIM : write a program to show the object input and object output of Stream class. PROGRAM