rohit_java
rohit_java
JAVA PROGRAMMING
CSE Department
SR.NO. PROGRAMS/TOPICS DATE SIGNATURE
import java.util.Scanner;
num = scanner.nextInt();
scanner.close();
number = num;
if(total == num)
else
}
PROGRAM-2
Write a program to demonstrate method overloading with different number of
parameters in argument list.
class MethodOverloading {
private static void display(int a){
System.out.println("Arguments: " + a);
}
public Car()
System.out.println("Class Car");
public Maruti()
System.out.println("Class Maruti");
System.out.println("Brand: Maruti");
System.out.println("Max: 90Kmph");
public Maruti800()
System.out.println("Max: 80Kmph");
obj.vehicleType();
obj.brand();
obj.speed();
}
PROGRAM-5
Try to implement the concept of multiple inheritance with use of
Interfaces .
interface AnimalEat {
void eat();
interface AnimalTravel {
void travel();
System.out.println("Animal is eating");
System.out.println("Animal is travelling");
a.eat();
a.travel();
}
PROGRAM-6
Write a program that demonstrate use of package and import statement.
1).
package pack;
public class A{
public void add(int a,int b)
{
System.out.println(a+b);}
}
2).
package mypack;
Import pack.*;
Class B{
Public static void main(String args[])
{
A.obj=new a();
Obj.add(5,10);
}
}
PROGRAM-7
Write a program to demonstrate user define exception .
class MyException extends Exception {
public MyException(String s)
{
// Call constructor of parent Exception
super(s);
}
}
p1.start();
c1.start();
class Shop
try
wait();
available = false;
notifyAll();
return materials;
try
wait();
ie.printStackTrace();
materials = value;
available = true;
notifyAll();
Shop = c;
this.number = number;
value = Shop.get();
Shop = c;
this.number = number;
Shop.put(i);
try
sleep((int)(Math.random() * 100));
ie.printStackTrace();
} }}}