Hallo Ich versuche, dieses zu erhalten, durch meinen Code reloop aber es scheint nur Ausgang, nachdem er die Box druckt:Erneutes Ausführen meine Hauptmethode nach meiner boxPrint Methode
import java.util.Scanner;
public class BoxPrint1 {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);// create scanner object called input
// delcare variables
int column;
int row;
System.out.printf("%nThis program prints a box"); // prompt user for input
System.out.printf("%n Please enter # of columns (< 1 to exit):");
column = input.nextInt();
System.out.printf("%n Please enter # of rows (< 1 to exit):");
row = input.nextInt();
boxPrint(column, row);
while(column > 0 && row > 0);
{ // calls boxPrint method and passes two arguments
// prompt user for input
System.out.printf("%n Please enter # of columns (< 1 to exit):");
column = input.nextInt();
System.out.printf("%n Please enter # of rows (< 1 to exit):");
row = input.nextInt();
}
}// end main
public static void boxPrint(int column, int row)
{
//insert nested for loops below
for(int i = 0; i < row; i++)
{
for(int j = 0; j < column; j++)
{
// prints * j times in a row
System.out.printf("*");
}
System.out.println();
} // end boxPrint method
}
// end class BoxPrint1
}
, dass mein Code ist und in der Regel bekomme ich der Ausgang (was sie ausgeben soll)
usw. so, aber es nicht zu meiner Hauptmethode reloop und fragen Sie erneut nach Eingabe?
Verwenden Sie while (true) am Anfang der Hauptmethode und schließen Sie es kurz vor // end main. – user6657161