问个菜鸟的问题,整型变量可以直接被赋予字符型常量么,不需要强制转换么?
以下就是:
???????????????????????
int ch=0;
System.out.println("please enter info, input bye for exit");
while(true)
{
try
{
ch=System.in.read();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
switch(ch)
{
case '\r':
break;
case '\n':
strInfo=new String(buf,0,pos);
if(strInfo.equals("bye"))
return;
else
?????????????????????????
中没有强制转换就直接赋给正型ch了