-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
41 lines (36 loc) · 913 Bytes
/
Student.java
File metadata and controls
41 lines (36 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Scanner;
public class Student {
String name ;
int rollNum;
int marks[]= new int[5];
Scanner sc = new Scanner(System.in);
void Read()
{
System.out.print("Enter the Student name: ");
name = sc.nextLine();
System.out.print("Enter the Student Roll Number: ");
rollNum = sc.nextInt();
System.out.print("Enter the Student Marks: ");
for(int i=0;i<5;i++)
{
marks[i]=sc.nextInt();
}
}
void Display()
{
System.out.println("Student Name: "+name);
System.out.println("Student Roll num: "+rollNum);
System.out.println("Student marks: ");
for(int i=0;i<5;i++)
{
int si=i+1;
System.out.println(si+"."+" "+marks[i]);
}
}
public static void main(String args[])
{
Student obj = new Student();
obj.Read();
obj.Display();
}
}