终于学会怎么使用java手册了,先要查找类,然后在使用ctrl+f查找所要查找的方法
php的手册可以直接查找着这点使用起来十分方便
关于字符串对比,php中可以直接使用等号(==),而java中竟然要使用equals进行对比,使用==无法得到正确的结果
public class lesson7 {
public static void main(String [] args)
{
byte [] buf = new byte[1024];
String strInfo = null;
int pos = 0;
int ch = 0;
System.out.print("please enter info:");
while(true)
{
try
{
ch = System.in.read();
}catch(Exception e){e.printStackTrace();}
switch(ch)
{
break;
strInfo = new String(buf,0,pos);
if(strInfo.equals("bye"))
{
return;
}else{
System.out.print(strInfo);
pos=0;
break;
}
default:
buf[pos++] = (byte)ch;
}
}
}
}



Comment:


