Practical Document
Practical Document
class NumberValue
{
num = 6;
}
public NumberValue(int n)
{
num = n;
{
System.out.println("The number is: " + num);
}
NumberValue();
NumberValue obj2 = new
NumberValue(15);
obj1.display();
obj2.display();
***********************************************************
OUTPUT:-
Practical No 13. Develop a Program for Implementation
Array .Program:-
}
}
OUTPUT:-
Practical No 14. Develop a Program for Implementation
Vector. Program:-
import
java.util.Vector;
class Main
{
public static void main(String[] args)
{
Vector<String> student= new
Vector<>(); student.add("SUNIL");
student.add("ANIL");
student.add("SAI");
}
OUTPUT:-
Practical No 15 .
➢ Develop a Program for Implementation of Wrapper Class to
Primitive into Object
Program:-
public class
WrapperExample1
int a=80;
Integer
i=Integer.valueOf(a);
Integer j=a;
System.out.println(a+"
"+i+" "+j);
}
}
OUTPUT:-
Practical 16.
➢ Wrapper Class to Object into Primitive.
Program:-
int i=a.intValue();
int j=a;
***********************************************************
OUTPUT
Practical No 17.
➢ Develop a Program Which Implement the Concept of
overriding.
Program:-
class Principal
{
System.out.println("I am Principal.");
}
}
super.displayInfo();
System.out.println("I am Teacher");
}
}
super.displayInfo();
System.out.println("I am Student");
}
}
class Main
{
public static void main(String[] args)
{
Student s = new Student();
s.displayInfo();
s.displayInfo();
}
*********************************************
OUTPUT:-
Practical No 18.
➢ Develop a Program for Implementation Single Inheritance.
Program:-
class Manager
{
void profit()
System.out.println("PROFIT");
void loss()
System.out.println("LOSS");
class TestInheritance
{
Employee e=new Employee();
e.profit();
e.loss();
***********************************************************
OUTPUT:-
Practical No 18.
➢ Develop a Program for Implementation Multilevel
Inheritance.
Program:-
class Painter
{
void paint()
{
System.out.println("PAINT");
void teach()
{
System.out.println("TEACHING");
}
}
class Writer extends Teacher
{
void writ()
{
System.out.println("WRITING");
}
class TestInheritance
{
public static void main(String args[])
w.Paint();
w.teach();
w.writ();
****************************************************
OUTPUT:-
Practical No 19.
➢ Develop a Program for Implementation Multiple
Inheritance.
Program:-
interface Event
{
interface Cricket
{
System.out.println("Start Event");
}
System.out.println("Show Badminton");
}
};
badminton.start();
badminton.play();
badminton.show();
}
}
OUTPUT:-