摘要:
yield方法是 Thread类的方法 /** * Causes the currently executing thread object to temporarily pause * and allow other threads to execute. */ public static nat 阅读全文
摘要:
join是Thread类的方法 /** * Waits for this thread to die. * * @exception InterruptedException if any thread has interrupted * the current thread. The <i>int 阅读全文
摘要:
在Thread类中有一个 整数型 变量 threadStatus ,标示了该线程的状态,它是一个int类型,但是对应的get方法返回值是一个枚举State,源码如下: public enum State { /** * Thread state for a thread which has not 阅读全文
摘要:
新建一个类 public class demo1 { public void doSomething(String arg){ System.out.println("反射机制"+arg); }} 然后建一个测试类 public class ReflexTest { public static vo 阅读全文
摘要:
在函数中定义的一些基本类型的变量和对象的引用变量都在函数的栈内存中分配。 当在一段代码块定义一个变量时,Java就在栈中为这个变量分配内存空间,当超过变量的作用域后,Java会自动释放掉为该变量所分配的内存空间,该内存空间可以立即被另作他用。Java自动管理栈和堆,程序员不能直接地设置栈或堆。 ja 阅读全文