println() 通过写入行分隔符字符串来终止当前行。print() 方法只打印给定的内容。示例实时演示public class Sample { public static void main(String args[]) { System.out.println("Hello"); System.out.println("how are you"); System.out.print("Hello"); System.out.print("how are you"); } }输出Hello how are you Hellohow are you
将序列化对象写入文件后,可以从文件中读取并反序列化,即,表示对象及其数据的数据类型信息和字节可以用来在内存中重新创建对象。示例import java.io.*; public class DeserializeDemo { public static void main(String [] args) { Employee e = null; try { FileInputStream fileIn = new FileInputStream("/tmp/employee.ser"); ObjectInputStream in = new ObjectInputStream(fileIn); e = (Employee) in.readObject(); in.close(); ... 阅读更多