会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133626个问题

package com.bjsxt.ObjectLiu;

import java.io.*;

public class TestStudent {
    public static void main(String[] args) {
          //write();//调用写对象的方法
        read();//调用读对象的方法
    }
    public static void write(){
        ObjectOutputStream oos= null;
        try {
            //oos = null;
            oos=new ObjectOutputStream(new FileOutputStream("E:\\student.txt"));
            Student stu=new Student("marry",20,"888888");
            Student.schoolName="JN校区";
            oos.writeObject(stu);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            //关闭
            if (oos!=null){
                try {
                    oos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
    public static void read(){
        ObjectInputStream ois= null;
        try {
            ois = null;
            ois=new ObjectInputStream(new FileInputStream("E:\\student.txt"));
            Student stu = (Student) ois.readObject();
            System.out.println(stu);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }finally {
            //关闭流
            if(ois!=null){
                try {
                    ois.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
//打印结果:Student{name='marry', age=20, pwd='null'}schoolName=null
//杜老师,为什么我的打印结果含有单引号,而讲课的老师的打印结果是没有单引号的,麻烦您帮忙看一下,谢谢您


JAVA 全系列/第二阶段:JAVA 基础深化和提高/IO 流技术(旧) 19231楼

老师我这里有一个疑问前台显示页面是8082端口,当搜索时发送的请求时http://localhost:8083/search.html?q=%E6%89%8B%E6%9C%BA

是发送到8083端口,那8083这个项目的controller不应该加上@crossorigin么?为什么8083的项目的controoler

不加@crossorigin也能访问到?

JAVA 全系列/第十八阶段:亿级高并发电商项目_架构/编码(旧)/电商:使用Solr实现数据搜索 19233楼

servletdemo.rar

不知道为什么报错,报错后控制台还响应出结果为什么


JAVA 全系列/第六阶段:JavaWeb开发/Servlet技术详解 19234楼
人工智能/第四阶段:人工智能基础-高等数学知识强化/线性代数高级 19236楼
JAVA 全系列/第十四阶段:分布式文件存储与数据缓存/Nginx 19237楼
JAVA 全系列/第十一阶段:分布式RPC调用和分布式文件存储/FastDFS 19244楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637