July 05, 2013

Java Program for Student Details

Write the java program for student details



STUDENTS


import java.io.*;

class per_details
{
String name[]=new String[5];
String rol_n[]=new String[5];
String cl[]=new String[5];
String ad[]=new String[5];
int age[]=new int[5];
String str;
void details()
{
DataInputStream in=new DataInputStream (System.in);
try{

for(int i=0;i<5;i++)
{
            System.out.println("Enter the name of the student:");
            name[i]=in.readLine();
            System.out.println("Enter the roll number:");
            rol_n[i]=in.readLine();
            System.out.println("Enter the age:");
            age[i]=Integer.parseInt(in.readLine());
            System.out.println("Enter the class of the student:");
            cl[i]=in.readLine();
            System.out.println("Enter the address:");
            ad[i]=in.readLine();
}
}

catch(Exception a){}
}

void dis()
{
System.out.println("Details Of the Student are as follows:");
for(int i=0;i<5;i++)
{
            System.out.println("       STUDENT:"+(i+1));
            System.out.println("Name:"+name[i]);
            System.out.println("Roll no.:"+rol_n[i]);
            System.out.println("Age:"+age[i]);
            System.out.println("Class:"+cl[i]);
            System.out.println("Address:"+ad[i]);
}
}
}

class stud
{
public static void main(String args[])
{
per_details p=new per_details();
p.details();
p.dis();
}
}
  

OUTPUT

C:\Program Files\Java\jdk1.5.0\bin>java stud

Enter the name of the student:
praju
Enter the roll number:
67
Enter the age:
21
Enter the class of the student:
teit
Enter the address:
marcel
Enter the name of the student:
moksh
Enter the roll number:
72
Enter the age:
22
Enter the class of the student:
teit
Enter the address:
ponda
Enter the name of the student:
tara
Enter the roll number:
69
Enter the age:
22
Enter the class of the student:
teit
Enter the address:
vasco
Enter the name of the student:
rajkumari
Enter the roll number:
45
Enter the age:
21
Enter the class of the student:
teit
Enter the address:
ponda
Enter the name of the student:
sonam
Enter the roll number:
73
Enter the age:
21
Enter the class of the student:
teetc
Enter the address:
Margao

Details Of the Student are as follows:
            STUDENT:1
Name:praju
Roll no.:67
Age:21
Class:teit
Address:marcel
            STUDENT:2
Name:moksh
Roll no.:72
Age:22
Class:teit
Address:ponda
            STUDENT:3
Name:tara
Roll no.:69
Age:22
Class:teit
Address:vasco
            STUDENT:4
Name:rajkumari
Roll no.:45
Age:21
Class:teit
Address:ponda
            STUDENT:5
Name:sonam
Roll no.:73
Age:21
Class:teetc
Address:margao


No comments:
Write comments