Write a Java code snippet with a nested for loop to print five rows of six random integers between 5 and 10 inclusive.
// TestCode.java import java.util.Random; public class TestCode { public static void main(String[] args) { Random rand = new Random(); for(int i = 0;i<5;i++){ for(int j = 0;j<6;j++){ System.out.print((rand.nextInt(6)+5)+" "); } System.out.println(); } } }
Get Answers For Free
Most questions answered within 1 hours.