public class TestThread2 implements Runnable{ public TestThread2(){ System.out.println(Thread.currentThread().getName()); } @Override public void run() { System.out.println(Thread.currentThread().getName()+"线程开始"); for (int i = 0;i<20;i++){ System.out.println(Thread.currentThread().getName()+" "+i); } System.out.println(Thread.currentThread().getName()+"线程结束"); } public static void main(String[] args) { System.out.println("主线程开始"); TestThread2 testThread2 = new TestThread2(); Thread t1 = new Thread(testThread2); t1.start(); Thread t2 = new Thread(new TestThread2()); t2.start(); System.out.println("主线程结束"); } }
为什么我这个线程是按顺序来的?
老师好!请问分号前面什么时候写1? 什么时候不用写?或者可以写其他数字吗?
在continue 在 loop 外部。 在 switch 或 loop 外部中断 这是什么意思
java.util.Scanner; cishui { main(String[] args){ Scanner s=Scanner(System.); System..println(); System..println(); x=; (){ System..println(); monthSalary=s.nextInt(); System..println(); months=s.nextInt(); yearSalary; (monthSalary*months>&&monthSalary*months<){ System..println(); }{ System..println(); } } System..println(); come=s.nextInt(); (come==){ System..println(); ; } (come==){ System..println(); ; } }
老师我的spring测试依赖加不上去,可以帮我看看嘛
2022版本的平行运行在哪儿呀
老师 课程资料上的思维导图防大了很糊啊 根本看不了
public void start() { Menu menu = new Menu(); TelNoteRegex regex = new TelNoteRegex(); Operate operate = new Operate(); File file = new File("/Users/JAVA/a.txt"); ObjectInputStream ois = null; Object o = null; try { file.createNewFile(); ois = new ObjectInputStream(new FileInputStream(file)); if ((o = ois.readObject())==null){ return; }else { operate.ObjectInputStreamDemo(); } } catch (Exception e) { e.printStackTrace(); } while (true) { menu.mainMenu(); int item = regex.menuItemValidate(1, 6); switch (item) { case 1: operate.addLogic(); break; case 2: operate.searchLogic(); break; case 3: operate.modifyLogic(); break; case 4: operate.deleteLogic(); break; case 5: operate.orderLogic(); break; case 6: operate.ObjectOutputStreamDemo(); System.exit(0); } } }
我在这里做了判断了,为什么还会报EOF?
public void ObjectOutputStreamDemo(){ ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(new FileOutputStream("/Users/JAVA/a.txt",true)); for (Person temp:list){ oos.writeObject(temp); } oos.flush(); }catch (Exception e){ e.printStackTrace(); }finally { try { if (oos!=null){ oos.close(); } }catch (Exception e){ e.printStackTrace(); } } } public void ObjectInputStreamDemo(){ ObjectInputStream ois = null; try { ois = new ObjectInputStream(new FileInputStream("/Users/JAVA/a.txt")); Person a = null; while(true){ if ((a = (Person) ois.readObject())==null){ break; } Person person =(Person) ois.readObject(); this.list.add(person); } }catch (Exception e){ e.printStackTrace(); }finally { try { if(ois!=null){ ois.close(); } }catch (Exception e){ e.printStackTrace(); } } }
StreamCorruptedException这个报错我该怎么修改呢,有时候if语句中还会报类型强制转换的错误是为什么呢
老师,我觉得这个算错了,起始位置是(0,0)吧,算起点到终点距离,就是x1+y1结果开平方不就可以了
老师,需要你的帮助文档 java8 api。 可否分享
为什么其他两个都可以但京东出现拒绝访问呢?
老师,这里每行的列宽是怎么分配的,视频里没有讲到啊?是按照master的宽度自动设置的么?
为什么两个的选择不一样呢?
这章节是不是少了视频
这个咋报错
这个self.pack()有什么用呢?不要这个好像对程序运行也没影响
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637