-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethods
More file actions
27 lines (25 loc) · 739 Bytes
/
methods
File metadata and controls
27 lines (25 loc) · 739 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
package com.company;
import java.util.Scanner;
public class student {
int uid;
String name;
static String college = "Chandigarh university";
student(int uid,String name){
this.uid = uid;
this.name = name;
}
void show(){
System.out.println("uid of "+ name +" is "+uid+"\nHe is studying in "+college);
}
public static void main(String[] args) {
Scanner S = new Scanner(System.in);
System.out.println("Enter uid :");
int uid = S.nextInt();
System.out.println("Enter name :");
String name = S.next();
student st1 = new student(uid,name);
st1.show();
student st2 = new student(uid,name);
st2.show();
}
}