Javajam PDF
Javajam PDF
Javajam PDF
}
}
Output:
}
}
}
Output:
}
}
Output
}
System.out.println("Factorial of "+n+":"+fact);
}
}
Output
arr[i]=sc.nextInt();
}
System.out.print("Before Sorting: ");
for(int i=0;i<size;i++)
{
System.out.print(" "+arr[i]);
}
for(int i=0;i<size;i++)
{
int temp;
for(int j=i+1;j<size;j++)
{
if(arr[i]>arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
System.out.println();
System.out.print("After Sorting in ascending order: ");
for(int i=0;i<size;i++)
{
System.out.print(" "+arr[i]);
}
System.out.println();
System.out.print("After Sorting in descending order: ");
for(int i=size-1;i>=0;i--)
{
System.out.print(" "+arr[i]);
}
}
}
Output
}
}
Output
}
class Car extends Vehicle
{
int speed;
public Car(String name, int regNo,double cost,int speed)
{
super(name,regNo,cost);
this.speed=speed;
}
public void show()
{
super.display();
System.out.println("Car speed::"+speed);
}
}
class TestCar
{
public static void main(String[] args)
{
Car c=new Car("Maruthi",2022,100000,100);
c.show();
}
}
Output:
}
class TestStudent
{
public static void main(String[] args)
{
StudDetails s1=new StudDetails();
s1.display();
StudDetails s2=new StudDetails("XYZ",30,70.00);
s2.display();
}
}
Output
Output
}
}
catch(Exception e)
{
}
}
public static void main(String[] args)
{
MyThread m1=new MyThread();
MyThread m2=new MyThread();
m1.start();
m2.start();
}
}
Output
}
}
Output
}
import mypack.Addition;
public class TestPack
{
public static void main(String[] args)
{
Addition a=new Addition(50.25,20.60);
System.out.println("Addition of two
numbers::"+a.sum());
}
}
Output:
HTML FILE
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Geometrical Figures</title>
</head>
<body>
<applet code="Geo.class" width="400" height="400"></applet>
</body>
</html>
Output:
javac Geo.java
appletviewer Geo.html
}
public void mouseMoved(MouseEvent me)
{
msg=" mouse moved";
repaint();
}
public void mouseDropped(MouseEvent me)
{
msg=" mouse dropped";
repaint();
}
public void mouseDragged(MouseEvent me)
{
msg=" mouse dragged";
repaint();
}
}
HTML FILE:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Geometrical Figures</title>
</head>
<body>
<applet code="DemoMouse.class" width="400" height="400">
</applet>
</body>
</html>
Output:
javac DemoMouse.java
appletviewer DemoMouse.html
HTML FILE:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Geometrical Figures</title>
</head>
<body>
<applet code="DemoMouse.class" width="400" height="400">
</applet>
</body>
</html>
Output:
javac DemoMouse.java
appletviewer DemoMouse.html
Html file:
<html>
<head>
<title>Keyboard Event</title>
</head>
<body>
<applet code="DemoKey.class" width=400 height=300></applet>
</body>
</html>
javac DemoKey.java
appletviewer Key.html
Output: