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 //杜老师,为什么我的打印结果含有单引号,而讲课的老师的打印结果是没有单引号的,麻烦您帮忙看一下,谢谢您
#从控制台输入用户的月薪,进行运算计算出年薪。打印出用户的年薪
monthpay=input("请输入月薪:") print(id(monthpay)) anuualpayt=12*monthpay print(anuualpayt) print(id(float(monthpay))) anuualpay=12*float(monthpay) print(anuualpay)
运行结果:
请输入月薪:100
19053792
100100100100100100100100100100100100
17217056
1200.0
疑问:老师好,我不转换monthpay为浮点数的话,直接运算得出“100100100100100100100100100100100100”,这个想了一下,运算符号*,2边必须有一个是数值类(整数或者浮点数),另一个为非数值,不理会前后顺序,是不是就是把非数值的变量,复制多次。例如我的测试
老师我这里有一个疑问前台显示页面是8082端口,当搜索时发送的请求时http://localhost:8083/search.html?q=%E6%89%8B%E6%9C%BA
是发送到8083端口,那8083这个项目的controller不应该加上@crossorigin么?为什么8083的项目的controoler
不加@crossorigin也能访问到?
servletdemo.rar
不知道为什么报错,报错后控制台还响应出结果为什么
InetSocketAddress isa = new InetSocketAddress("localhost",9999); InetSocketAddress isa2 = new InetSocketAddress("127.0.0.1",9999); InetSocketAddress isa3 = new InetSocketAddress("192.168.1.2",9999);
isa返回结果:
isa2返回结果:
isa返回结果:
老师这三个不都是指本机嘛,为什么三次返回的主机名称不一样?只有输入IP地址的返回的我电脑的名称?
老师,特征值与奇异值的关系中,特征值是指U的特征值,还是指V的特征值呢?因为U、V都有对应的特征值
这要怎么解决啊,去网上查看了也没有找到答案
<script> var str='hello sxt! goodbye sxt'; while (str.indexOf('sxt')!=-1){ var newStr=''; newStr=str.replace('sxt','xxx'); } console.log(newStr); </script>
我这个怎么成死循环了呢,有什么不对吗,老师
老师:我用 baizhan 用户,进入 a.info 中,然后就不知道怎么退出 视频中好像 ctrl+c 进行退出的,但是我试过,没用哈
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script> var a = document.getElementsByTagName("div")[1] console.log(a) </script> </head> <body> <div> Hello Word!</div> <div> 2 </div> </body> </html>
我的怎么出undefined
程序:
问题:
老师我想问一下,在上面的这个程序中,我先定义的test01()这个函数,然后才定义的test02()这个函数,但是我在test01()这个函数中我调用了test02()这个函数,但是此时test02()这个函数我在之前并没有定义,而是在test01()后面定义的,为什么这个时候不会报错呢?
老师,我发现只有滑中li标签才有效果,我这里a标签就没有用,是为什么啊,a标签是被li标签覆盖了吗?
老师,这里
<div class="text">
<span class="name">魅族 18s Pro</span>
<span class="desc">限时领券至高立省1000 | 12期免息</span>
<span class="price"><i>¥</i>4599<em>起</em></span>
</div>
使用div的作用是什么?css里也没有专门定义text,我试了一下,不要div,效果一样。
网上的方法修改这个也不好使啊,没有werror
com.zy.study; java.util.Scanner; SalaryCalculator { main(String[] args) { Scanner scanner = Scanner(System.); System..println(); System..println(); () { System..println(); monthSalary = scanner.nextInt(); System..println(); yearCount = scanner.nextInt(); System..println(+(monthSalary*yearCount)); System..println(); count = scanner.nextInt();
//为什么不能用scanner.nextInt()实现 (scanner.nextInt() == ) { ; } (scanner.nextInt() == ){ ; } } } }
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637