-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstructor.java
More file actions
32 lines (32 loc) · 833 Bytes
/
Copy pathConstructor.java
File metadata and controls
32 lines (32 loc) · 833 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
29
30
31
32
class tanmay{
private int id;
private String name;
public tanmay(String myname,int myid){
System.out.println("Welcome! In java program");
name=myname;
id=myid;
System.out.println("my name is:"+name);
System.out.println("my id is:"+id);
}
public tanmay(int i,int j){
System.out.println("Addition of two number is"+(i+j));
}
public void setname(String myname){
name=myname;
}
public String getname(){
return name;
}
public void setid(int id){
this.id=id;
}
public int getid(){
return id;
}
}
public class Constructor{
public static void main(String[] args) {
tanmay tan=new tanmay("Tanmay Sanjay Gaidhani",112);
tanmay tana=new tanmay(1,2);
}
}