new semester, new repo structure
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package lab15_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Array5 {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
String[] alphaBetics = new String[5];
|
||||
final int NAME_SIZE = 20;
|
||||
|
||||
//print the array that has all nulls
|
||||
for (int i = 0; i < alphaBetics.length; i++) {
|
||||
System.out.println(alphaBetics[i]);
|
||||
}
|
||||
//init the array to character numbers
|
||||
for (int i = 0; i < alphaBetics.length; i++) {
|
||||
alphaBetics[i] = "index " + Integer.toString(i) + " ";
|
||||
}
|
||||
//append to the array 20 random alphabetic characters
|
||||
for (int i = 0; i < alphaBetics.length; i++) {
|
||||
for (int j = 0; j < NAME_SIZE; j++) {
|
||||
alphaBetics[i] += (char) (65 + Math.random() * 26);
|
||||
}
|
||||
}
|
||||
|
||||
//print the array again
|
||||
for (int i = 0; i < alphaBetics.length; i++) {
|
||||
System.out.println(alphaBetics[i]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user