1
您好那里我试图从键盘输入3个整数,并打印星号的行等于从键盘输入的整数。我很感激,如果有人可以提供帮助,请提前致谢。从键盘输入并打印出星号
public class Histogram1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Please input the first integer for histogram1: ");
int a1 = in.nextInt();
System.out.print("Please input the second integer for histogram1: ");
int b1 = in.nextInt();
System.out.print("Please input the third integer for histogram1: ");
int c1 = in.nextInt();
histogram1();
}
public static void histogram1(){
int n =0;
for (int i = 0; i <= n; i++)
{
for(int j = 1; j <=n; j++)
{
System.out.println("*");
}
System.out.println();
}
}
}
是。非常感谢。你解决了我的困境。 :) – 2012-03-24 20:08:00
谢谢,我真的需要一个扫描仪和方法histogram1不应该有一个参数,这将如何可能? – 2012-03-24 20:20:00
感谢您的帮助! :) – 2012-03-24 20:33:43