[go: up one dir, main page]

0% found this document useful (0 votes)
23 views1 page

PR 7

The document shows code for a Java program that takes student enrollment numbers, names, and total scores as input using a constructor and displays the stored student information.

Uploaded by

Sukanya Nagare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

PR 7

The document shows code for a Java program that takes student enrollment numbers, names, and total scores as input using a constructor and displays the stored student information.

Uploaded by

Sukanya Nagare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

Scanner;
public class A07Constructor{
public static void main(String args[]){
StudentInfo stu[] = new StudentInfo[3];
for(int i = 0; i < 3; i++)
stu[i] = new StudentInfo();
System.out.println("\t\tStudent Details");
System.out.println("Enrollment
no.\t\tName\t\tTotal");
for(int i = 0; i < 3; i++)
stu[i].displayInfo();
}
}
class StudentInfo{
Scanner sc = new Scanner(System.in);
String eid;
String name;
int s1, s2, s3, total;
StudentInfo(){
readStudentInfo();
}
public void readStudentInfo(){
System.out.println("Enter student details");
System.out.println("Enrollment no: ");
import java.util.Scanner;
public class A07Constructor{
public static void main(String args[]){
StudentInfo stu[] = new StudentInfo[3];
for(int i = 0; i < 3; i++)
stu[i] = new StudentInfo();
System.out.println("\t\tStudent Details");
System.out.println("Enrollment
no.\t\tName\t\tTotal");
for(int i = 0; i < 3; i++)
stu[i].displayInfo();
}
}
class StudentInfo{
Scanner sc = new Scanner(System.in);
String eid;
String name;
int s1, s2, s3, total;
StudentInfo(){
readStudentInfo();
}
public void readStudentInfo(){
System.out.println("Enter student details");
System.out.println("Enrollment no: ");

You might also like