Hi there I’m trying to input 3 integers from the keyboard and print rows of asterisks equal to the integers input from keyboard. I really appreciate if someone could help on this, thanks in advance.
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();
}
}
}
is it what you want ?!
as you asked for not having an argument, you can use a static variable in your class. I also changed the names to more meaningful variable names, as it is always a good idea to correctly choose good names for variables.
public class Histogram1 {
}