class Res
{
String name;
String sex;
}
class Input implements Runnable
{
private Res r;
Input(Res r){
this.r=r;
}
public void run(){
int x=0;
while (true)
{
if (x==0)
{
r.name="mike";
r.sex="man";
}
else
{
r.name="丽丽";
r.sex="女女女女女女女女女";
}
x = (x+1)%2;
}
}
}
class Output implements Runnable
{
private Res r;
Output(Res r){
this.r=r;
}
public void run(){
while (true)
{
System.out.println(r.name+",,,,"+r.sex);
}
}
}
class InputOutputDemo3
{
public static void main (String [] args){
Res r = new Res();
Input in = new Input(r);
Output out = new Output(r);
Thread t1 = new Thread(in);
Thread t2 = new Thread(out);
t1.start();
t2.start();
}
}
实在搞不懂 怎么还出现这种 代码 是不是编码的问题
---------- java ----------
丽丽,,,,man
丽丽,,,,女女女女女女女女女
mike,,,,ŮŮŮŮŮŮŮŮŮ
mike,,,,ŮŮŮŮŮŮŮŮŮ
丽丽,,,,man
丽丽,,,,女女女女女女女女女
mike,,,,man
丽丽,,,,女女女女女女女女女
mike,,,,ŮŮŮŮŮŮŮŮŮ
mike,,,,ŮŮŮŮŮŮŮŮŮ
mike,,,,ŮŮŮŮŮŮŮŮŮ
|