-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram8.java
More file actions
55 lines (34 loc) · 831 Bytes
/
Copy pathProgram8.java
File metadata and controls
55 lines (34 loc) · 831 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class Gen<T,V>{
T ob1;
V ob2;
Gen(T x, V y)
{
ob1=x;
ob2=y;
}
T getob1()
{
return ob1;
}
V getob2()
{
return ob2;
}
void showType()
{
System.out.println("value of T is"+ob1.getClass().getName());
System.out.println("value of V is"+ob2.getClass().getName());
}
}
class Program8{
public static void main(String args[])
{
Gen<Integer,String> iob;
iob=new Gen<Integer,String>(100,"Evening college");
int x=iob.getob1(); //Auto UnBoxing
System.out.println("The value for x is"+" "+x);
String y=iob.getob2();//Auto UnBoxing
System.out.println("The value for y is"+y);
iob.showType();
}
}