-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathSingle.java
52 lines (52 loc) · 1.05 KB
/
Single.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
44
45
46
47
48
49
50
51
52
import java.util.Scanner;
class Studentdetails
{
String name;
int age;
int rollno;
Scanner sc=new Scanner(System.in);
void input()
{
System.out.println("enter the name of student");
name= sc.nextLine();
System.out.println("enter the age of student");
age=sc.nextInt();
System.out.println("enter the rollno of the student");
rollno=sc.nextInt();
}
void display()
{
System.out.println("Name:" +name);
System.out.println("Age:" +age);
System.out.println("Roll no:" +rollno);
}
}
class Student extends Studentdetails
{
private int a,b,c;
void Academics()
{
input();
System.out.println("enter the marks of physics");
a=sc.nextInt();
System.out.println("enter the marks of maths " );
b=sc.nextInt();
System.out.println("enter the marks of chemistry");
c=sc.nextInt();
}
void getDisplay()
{
display();
System.out.println("Physics:" +a);
System.out.println("Maths:" +b);
System.out.println("Chemistry:" +c);
}
}
class Single{
public static void main(String args[])
{
Student S=new Student();
S.Academics();
S.getDisplay();
}
}