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