LAB MANUAL Java CS406 FORMAT
LAB MANUAL Java CS406 FORMAT
Lab Manual
Approval
Year/Sem: II /IV
Session:Jan-June 2020
Approved By:
Coordinator HOD
CS-406
02 Write a program to
show Concept of
CLASS in JAVA
03 Write a program to
initialize array in java
04 Write a program to
show Access Specifies
(Public, Private,
Protected) in JAVA
05 Write a Program to
show Inheritance
06 Write a program to
show Polymorphism
07 Write a program to
show How Exception
Handling is in JAVA
08 Write a program to
show use and
Advantages of
CONTRUCTOR
09 Write a program to Add
a Class to a Package
10 Write a program to
show Life Cycle of a
Thread
11 Write a Program to
show Data Base
Connectivity Using
JAVA
12 Write a Program to
show “HELLO JAVA ”
in Explorer using Applet
Total marks obtained
PROGRAM:
class Main
int a=10;
int b=10;
int c=a+b;
System.out.println("value of a="+a);
System.out.println("value of b="+b);
System.out.println("sum="+c);
PROGRAM:
class Student{
int rollno;
String name;
rollno=r;
name=n;
class TestStudent4{
s1.insertRecord(111,"Karan");
s2.insertRecord(222,"Aryan");
s1.displayInformation();
s2.displayInformation();
PROGRAM:
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
int n, max;
Scanner s = new Scanner(System.in);
System.out.print("Enter number of elements in the array:");
n = s.nextInt();
int a[] = new int[n];
System.out.println("Enter elements of array:");
for(int i = 0; i < n; i++)
{
a[i] = s.nextInt();
}
max = a[0];
for(int i = 0; i < n; i++)
{
if(max < a[i])
{
max = a[i];
}
}
System.out.println("Maximum value:"+max);
}
}