-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathstatic_stud.java
More file actions
47 lines (30 loc) · 1.02 KB
/
static_stud.java
File metadata and controls
47 lines (30 loc) · 1.02 KB
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
import java.util.*;
class student{
static String clas;
String name;
student(String name){
this.name = name;
}
}
class static_stud{
static String clas;
public static void main (String args[]) {
Scanner sc = new Scanner(System.in);
String name;
System.out.println("Enter the name of first student : ");
name = sc.next();
student a = new student(name);
a.clas = "Nine";
System.out.println("Enter the name of Second student : ");
name = sc.next();
student b = new student(name);
System.out.println("Name : "+a.name+" class : "+a.clas);
System.out.println("Name : "+b.name+" class : "+b.clas);
}
static{
System.out.println("Enter the name of student of same class : ");
Scanner sc = new Scanner(System.in);
System.out.println("Enter the class : ");
clas = sc.next();
}
}