Java |
class Test
{
final int afield = 5;
final int workday = 256;
...
int getAfield() {
return afield;
}
}
//set method is not allowed for both finals
//cannot be written to by a constructor
|
|
C# |
class Test
{
readonly int afield;
const byte workday = 256;
Test(int n) {
afield = n;
}
...
int getAfield() {
return afield;
}
}
//set method is not allowed for both.
//readonly can only be written to by a constructor
|
|