is there way write *`transient`* *`final`* *`int`*...
# android
y
is there way write
transient
final
int
m = 50;
i want to map this line at kotlin Not use
Copy code
companion object
m
Copy code
@Transient
val m = 50
y
not give me the same result when use write stream this variable inside object like this example at java
class
Test *implements*
Serializable
{
transient
final
int
m = 50;
public
static
void
main(String[] args) *throws*
Exception
{
Test input = *new*
Test();
// serialization
FileOutputStream fos = *new*
FileOutputStream("abc.txt");
ObjectOutputStream oos = *new*
ObjectOutputStream(fos);
oos.writeObject(input);
// de-serialization
FileInputStream fis = *new*
FileInputStream("abc.txt");
ObjectInputStream ois = *new*
ObjectInputStream(fis);
Test output = (Test)ois.readObject();
System.out.println("m = "
+ output.m);
}
}
when print m give me 50 is that right so transient no impact final or static variable then i convert this code to kotlin and use your declaration Result not the same because JVM it seem variable