class ObjectTest <type>
{
private type num1;
private type num2;
ObjectTest(type val1,type val2)
{
this.num1=val1;
this.num2=val2;
}
public type getValue1()
{
return num1;
}
public type getValue2()
{
return num2+num1; //Getting the compilation Error Here
}
};
class GenTest
{
public static void main(
String args[])
{
ObjectTest<Integer> it1= new ObjectTest<Integer>(236, 175);
System.out.println("int value 1---->"+it1.getValue1());
System.out.println("int value 2--->"+it1.getValue2());
}
};
when I compile the Above code I am getting the compilation Error at the comment line. Why that error raising...
I am adding the same data types...what is the reasion behind this.