yousef shaaban
06/18/2022, 3:21 PMtransient
final
int
m = 50;
i want to map this line at kotlin Not use
companion object
MR3Y
06/18/2022, 4:08 PM@Transient
val m = 50
yousef shaaban
06/18/2022, 4:23 PMclass
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);
}
}
yousef shaaban
06/18/2022, 4:27 PM