-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollege.java
More file actions
28 lines (23 loc) · 755 Bytes
/
Copy pathcollege.java
File metadata and controls
28 lines (23 loc) · 755 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
//write a program in java using a static variable to display a student detail where college name will be coming through static variable
class University {
static String college_name = "Symbiosis Institute of Technology";
String name;
int age;
University(String n, int a) {
name = n;
age = a;
}
void display() {
System.out.println("College Name: " + college_name);
System.out.println("Student Name: " + name);
System.out.println("Student Age: " + age);
}
}
public class college {
public static void main(String[] args) {
University s1 = new University("Prisha", 19);
University s2 = new University("Komal", 19);
s1.display();
s2.display();
}
}