CodeGym/Java 任务帮助/没太弄明白这个题呢 ? 有人A出来了么?周文超第 20 级Fairfield21.03.2021745次阅读2个评论没太弄明白这个题呢 ? 有人A出来了么? 有关 任务的问题 Externalizable Person Java 核心, 第 10 级, 课程 7 正在讨论 没太弄明白这个题呢 ? 有人A出来了么? 0 评论 (2)受欢迎新旧 你必须先登录才能发表评论 TaoLu 级别 20 ,泾县,China31 五月 2021, 09:29读和写顺序需要一致,不要使用writeChars 去对应readLine方法,可以使用writeUTF,readUTF或者writeObject,readObject方法 @Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(lastName); out.writeObject(firstName); out.writeInt(age); out.writeObject(mother); out.writeObject(father); out.writeObject(children); } @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { lastName = (String) in.readObject(); firstName = (String) in.readObject(); age = in.readInt(); mother = (Person)in.readObject(); father = (Person)in.readObject(); children = (List)in.readObject(); } +4 元. 级别 26 ,Taipei,Taiwan, Province of China6 四月 2023, 15:28謝謝 0