写法1:
public int a()
{
int i=0;
try
{
do sonething;
i++;
}
catch
{
throw new Exception("一个异常!");
}
return i;
}写法2:
public int a()
{
try
{
do something;
int i=0;
return i++;
}
catch
{
throw new Exception("一个异常!");
}
}
在net中1和2都通过编译,而在java中2无法通过,大家看一下。
public int a()
{
int i=0;
try
{
do sonething;
i++;
}
catch
{
throw new Exception("一个异常!");
}
return i;
}写法2:
public int a()
{
try
{
do something;
int i=0;
return i++;
}
catch
{
throw new Exception("一个异常!");
}
}
在net中1和2都通过编译,而在java中2无法通过,大家看一下。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货