摘要: 1,computer management->storage->disk management2,new sample volumealt+44=,alt+59=; 阅读全文
posted @ 2014-08-07 12:59 塔斯曼 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 卖出的票为负数的情况: class MyThread22 implements Runnable { private int ticket = 10; public void run() { for (int i = 0; i 0) { try { Thread.sle... 阅读全文
posted @ 2014-08-06 17:21 塔斯曼 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 在线程操作中,可以使用yield()方法将一个线程的操作暂时让给其他线程执行: class MyThread17 implements Runnable { public void run() { for (int i = 0; i " + i); if (i == 3) { ... 阅读全文
posted @ 2014-08-06 14:39 塔斯曼 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 在程序中允许一个线程进行暂时的休眠,直接使用Thread.sleep()方法即可实现休眠: class myThread11 implements Runnable { public void run() { for (int i = 0; i < 5; i++) { try { Thread.... 阅读全文
posted @ 2014-08-06 11:18 塔斯曼 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 在java运行时至少会启动两个线程,一个是main线程,一个是垃圾收集线程。 在线程操作中,可以使用join()方法让一个线程强制运行,线程强制运行期间,其他线程无法运行,必须等待此线程完成之后才可以继续执行: class myThread10 implements Runnable{ public void run() { for(int i=0;i10)... 阅读全文
posted @ 2014-08-06 10:53 塔斯曼 阅读(294) 评论(0) 推荐(0) 编辑
摘要: java中启动多线程有两种方法,一是继承Thread类,二是实现Runnable接口。 继承Thread类: java中正确地启动多线程不能直接调用run()方法,而是调用从Thread类中继承而来的start()方法。 class myThead01 extends Thread { private String name; public myThead01(Stri... 阅读全文
posted @ 2014-08-05 15:31 塔斯曼 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 打包jar文件和设置class路径: 查看jar文件内容: 阅读全文
posted @ 2014-08-05 14:15 塔斯曼 阅读(120) 评论(0) 推荐(0) 编辑
摘要: public class RuntimeExceptionDemo01 { public static void main(String[] args) { String string="123"; int temp=Integer.parseInt(string); System.out.println("123*123=: "+temp*temp)... 阅读全文
posted @ 2014-08-05 10:28 塔斯曼 阅读(485) 评论(0) 推荐(0) 编辑
摘要: div的异常抛给main来处理: class Math{ public int div(int i,int j)throws Exception{ int temp=i/j; return temp; } } public class ThrowsDemo01 { public static void ... 阅读全文
posted @ 2014-08-05 09:46 塔斯曼 阅读(132) 评论(0) 推荐(0) 编辑
摘要: interface Window { public void open(); public void close(); public void activated(); public void iconified(); public void deiconified(); } abstract class WindowAdapter im... 阅读全文
posted @ 2014-08-04 14:25 塔斯曼 阅读(108) 评论(0) 推荐(0) 编辑