Поддержи канал: / @dmitriymischuk
Я в Facebook: / mischuk.dmitry
Я в Instagram: / mischukdmitry
Блог: https://gojavabeginer.blogspot.com
import java.io.*;
public class User extends Person implements Externalizable{
private int userId;
private double userPhone;
public User(){}
public User(String userFirstName, String userLastName, int userId, double userPhone) {
super(userFirstName, userLastName);
this.userId = userId;
this.userPhone = userPhone;
}
public void setUserId(int userId) {
this.userId = userId;
}
public void setUserPhone(double userPhone) {
this.userPhone = userPhone;
}
public int getUserId() {
return userId;
}
public double getUserPhone() {
return userPhone;
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(this.getUserId());
out.writeDouble(this.getUserPhone());
out.writeUTF(this.getUserFirstName());
out.writeUTF(this.getUserLastName());
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
this.setUserId(in.readInt());
this.setUserPhone(in.readDouble());
this.setUserFirstName(in.readUTF());
this.setUserLastName(in.readUTF());
}
}
public class Person {
private String userFirstName;
private String userLastName;
public Person(){}
public Person(String userFirstName, String userLastName) {
this.userFirstName = userFirstName;
this.userLastName = userLastName;
}
public void setUserFirstName(String userFirstName) {
this.userFirstName = userFirstName;
}
public void setUserLastName(String userLastName) {
this.userLastName = userLastName;
}
public String getUserFirstName() {
return userFirstName;
}
public String getUserLastName() {
return userLastName;
}
}
On this page of the site you can watch the video online Java - урок 26.3 (Упаковка объектов при помощи Externalizable) with a duration of hours minute second in good quality, which was uploaded by the user Dmitriy Mischuk 13 April 2020, share the link with friends and acquaintances, this video has already been watched 393 times on youtube and it was liked by 20 viewers. Enjoy your viewing!