0% found this document useful (0 votes)
1K views

LAB MANUAL Java CS406 FORMAT

The document is a lab manual for a Programming Practices (Java) course. It contains 12 experiments to be completed in the lab, including programs to demonstrate concepts like classes, inheritance, polymorphism, exception handling, and database connectivity using Java. The manual was prepared by Ajay Malviya and approved by the coordinator and head of the department of Computer Science Engineering at Swami Vivekanand College of Engineering, Indore for the January-June 2020 session.

Uploaded by

Nidhi Khire
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

LAB MANUAL Java CS406 FORMAT

The document is a lab manual for a Programming Practices (Java) course. It contains 12 experiments to be completed in the lab, including programs to demonstrate concepts like classes, inheritance, polymorphism, exception handling, and database connectivity using Java. The manual was prepared by Ajay Malviya and approved by the coordinator and head of the department of Computer Science Engineering at Swami Vivekanand College of Engineering, Indore for the January-June 2020 session.

Uploaded by

Nidhi Khire
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Computer Science Engineering

Lab Manual
Approval

Subject Name: Programming Practices (a) (Java )

Subject Code: CS-406

Year/Sem: II /IV

Session:Jan-June 2020

Prepared By: Ajay Malviya

Faculty Name: Ms. Ruchi Saxena

Approved By:

Coordinator HOD

PROGRAMMING PRACTICES JAVA LAB MANUAL Page 1


Swami Vivekanand College of Engineering
Indore
Department of Computer Science Engineering

Session: Jan-June 2020


LAB MANUAL
Semester IV
Programming Practices (a) (Java )

CS-406

Submitted to: Submitted by:


Mrs. Ruchi Saxena Name: Ajay Malviya
Roll No:0822CS181006

PROGRAMMING PRACTICES JAVA LAB MANUAL Page 2


Swami Vivekanand College of Engineering
INDEX
Student Practical Evaluation Sheet

Date of Date of Marks Obtained


S. Signature Signature
Name of Experiment Experime Submissi
No. LW(10 PQ (10 of Student of Faculty
nt on
marks) marks)
01 Write a program to
show Scope of Variables

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

PROGRAMMING PRACTICES JAVA LAB MANUAL Page 3


EXPERIMENT NO. 01

AIM: Write a program to show Concept of CLASS in JAVA

PROGRAM:

class Main

public static void main(String[] args)

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);

PROGRAMMING PRACTICES JAVA LAB MANUAL Page 4


PROGRAMMING PRACTICES JAVA LAB MANUAL Page 5
EXPERIMENT NO.02

AIM: Write a program to show Concept of CLASS in JAVA.

PROGRAM:

class Student{

int rollno;

String name;

void insertRecord(int r, String n){

rollno=r;

name=n;

void displayInformation(){System.out.println(rollno+" "+name);}

class TestStudent4{

public static void main(String args[]){

Student s1=new Student();

Student s2=new Student();

s1.insertRecord(111,"Karan");

s2.insertRecord(222,"Aryan");

s1.displayInformation();

s2.displayInformation();

PROGRAMMING PRACTICES JAVA LAB MANUAL Page 6


PROGRAMMING PRACTICES JAVA LAB MANUAL Page 7
EXPERIMENT NO.03

AIM: Write a program to initialize array in java

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);
}
}

PROGRAMMING PRACTICES JAVA LAB MANUAL Page 8


PROGRAMMING PRACTICES JAVA LAB MANUAL Page 9

You might also like