api 字符串转换成整数
public class TestInteger {
public static void main(String[] args) {
int w=new Integer(args[0]).intValue(); //将一个字符串变为数字的方法
int h=Integer.parseInt(args[1]);
int j;
// int h=Integer.valueOf(args[1].intValue());
for (int i=0;i<h;i++)
{
StringBuffer sb=new StringBuffer(); //stringBuffer
// 后面可以带其他字符串
for(j=0;j<w;j++)
{
sb.append('*'); //append 后缀可加
}
System.out.println(sb.toString());//带ln是因为一行打完可以换行
}
}
}

浙公网安备 33010602011771号