M******o 发帖数: 121 | 1 这个如何?
private static int NUM_OS = 1;
private static int NUM_HS = 2;
private Semaphore oS = new Semaphore(NUM_OS);
private Semaphore hS = new Semaphore(NUM_HS);
private Semaphore entryS = new Semaphore(1);
public YourClass() {
oS.drainPermits();
hS.drainPermits();
}
public void O() {
entryS.acquire();
if (!tryAcquire(oS)) {
if (canGenerateH2O()) {
releaseForH2O();
entryS.release();
} else {
entryS.release();
oS.aquire... 阅读全帖 |
|
h*****0 发帖数: 4889 | 2 YourClass a = null;
a.method(); |
|
c********l 发帖数: 125 | 3 你这些问题太基础,版上的人也没有义务教你 java 101
path 问题你可以google java classpath 具体可以 java -cp 路径/包名 yourclass
你很多问题youtube什么可以轻易找到答案 比如java classpath搜
另外你要开始用ide比如eclipse
如果转行没有基础,下个马士兵java 视频看一遍,基础的东西有个sense
import
file |
|
j********r 发帖数: 21 | 4 use "class YourClass;" to declare the class before you use.
However, you may not use its methods. Move class declaration in a .H file. |
|