I have a simple program as below:
class SerializationBox implements Serializable
{
private byte serializableProp = 10;
public byte getSerializableProp()
{
return serializableProp;
}
public void setSerializableProp(byte serializableProp)
{
serializableProp = serializableProp;
}
}
public class SerializationSample
{
/**
* @param args
*/
public static void main(String args[])
{
SerializationBox serialB = new SerializationBox();
serialB.setSerializableProp(1); // Here i get an error
}
}
At the indicated place in code I get error that "The method setSerializableProp(byte) in the type SerializationBox is not applicable for the arguments (int)".
I believed that as per the link http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html , I am allowed to pass -128 to 127 as the arguement.
Please let me know what I am missing?