摘要:
在线程操作中,可以使用yield()方法将一个线程的操作暂时让给其他线程执行: class MyThread17 implements Runnable { public void run() { for (int i = 0; i " + i); if (i == 3) { ... 阅读全文
摘要:
在程序中允许一个线程进行暂时的休眠,直接使用Thread.sleep()方法即可实现休眠: class myThread11 implements Runnable { public void run() { for (int i = 0; i < 5; i++) { try { Thread.... 阅读全文
摘要:
public class RuntimeExceptionDemo01 { public static void main(String[] args) { String string="123"; int temp=Integer.parseInt(string); System.out.println("123*123=: "+temp*temp)... 阅读全文
摘要:
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 ... 阅读全文
摘要:
interface Window { public void open(); public void close(); public void activated(); public void iconified(); public void deiconified(); } abstract class WindowAdapter im... 阅读全文