Here you can find the source of writeObject(Object obj, ObjectOutput out)
public static void writeObject(Object obj, ObjectOutput out) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.ObjectOutput; public class Main { public static final int NULL = 0x00; public static final int NOTNULL = 0x01; public static void writeObject(Object obj, ObjectOutput out) throws IOException { if (obj == null) { out.writeObject(NULL);//from w ww . ja v a2 s . c om } else { out.writeObject(NOTNULL); out.writeObject(obj); } } }