又出问题了!

horse_leo_zhcn horse_leo_zhcn 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
class Computer
{
String name = "电脑主机";
boolean flag = false;
public synchronized void set(String name)
{
if(!flag)
try
{
super.wait();
}
catch(InterruptedException e)
{
e.printStackTrace();
}
this.setName(name);
flag = false;
super.notify();
}
public synchronized void get(String name)
{
if(flag)
try
{
super.wait();
}
catch(InterruptedException e)
{
e.printStackTrace();
}
System.out.println(this.getName());
flag = true;
super.notify();
}
public String getName()
{
return name;
}

public void setName(String name)
{
this.name = name;
}
}
class Producer implements Runnable
{
Computer computer = null;
public Producer(Computer computer)
{
this.computer = computer;
}
public void run()
{
boolean flag = false;
for(int i=0;i<10;i++)
{
if(flag)
{
this.computer.set("电脑主机");
flag = false;
}
else
{
this.computer.set("显示器");
flag = true;
}

}
}
}
class Consumer implements Runnable
{
Computer computer = null;
public Consumer(Computer computer)
{
this.computer = computer;
}
public void run()
{
for(int i=0;i<10;i++)
try
{
Thread.sleep(100);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
this.computer.getName();
}
}

public class ComputerTest
{
public static void main(String[] args)
{
Computer comp = new Computer();
Producer pro = new Producer(comp);
Consumer con = new Consumer(comp);
new Thread(pro).start();
new Thread(con).start();
}

}

出现下列提示:
F:\>javac ComputerTest.java
javac: 找不到文件: ComputerTest.java
用法: javac <options> <source files>
-help 用于列出可能的选项

本来就是放在f盘根目录先的嘛,怎么会提示找不到呢?
...全文
评论 9
收藏 已收藏
分享
返回顶部
horse_leo_zhcn
Java SE 62,621 成员 307,251 内容