-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudent.java
43 lines (41 loc) · 1017 Bytes
/
student.java
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
40
41
42
43
import java.util.Scanner;
class student1
{
String name;
int roll_no;
int[]mark;
void read()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the name of student");
name=sc.next();
System.out.println("enter the roll number");
roll_no=sc.nextInt();
System.out.println("enter the mark of %subject");
mark=new int[10];
for(int i=0;i<5;i++)
{
mark[i]=sc.nextInt();
}
}
void display()
{
System.out.println("student name is:"+name);
System.out.println("roll number is:"+roll_no);
for(int i=0;i<5;i++)
{
System.out.println("mark of subject"+(i+1)+"is"+mark[i]);
}
}
}
class student
{
public static void main(String args[])
{
student1 s=new student1();
System.out.println("enter the student details...");
s.read();
System.out.println("The student details are");
s.display();
}
}