forked from roesnera/JavaIntro3Debrief
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
74 lines (39 loc) · 2.48 KB
/
Copy pathMain.java
File metadata and controls
74 lines (39 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.example.main;
import java.util.Arrays;
class Main {
public static void main(String[] args) {
System.out.println("Welcome to our Java Unit 3 Closing CFU");
/*
Some activities for Array
*/
//create an array (not an ArrayList) called favoriteColors that holds five strings with your favoriteColors and print the entire array to the screen.
//Change the third element of facoriteColors to a different color and print that element to the sceen
//Declare and initialize and array of type int called numbers to hold 1000 elements (this should be used later in the loop exercise)
//ArrayList
//Declare and initialize an ArrayList so that it holds values of type <Double>.
//Using the .add() method, add 5 decimal values to the ArrayList and print it to the screen
//Using the .remove() method, remove the 3rd value in the ArrayList.
//Print ArrayList to the screen.
//Now change the last element in the ArrayList and print the new element to the screen
/*
Some activities for Loops
*/
// write a for loop that prints out numbers 1-1000 and saves these numbers to the empty array you created earlier
// write a while loop that prints the elements of the array you used in the previous exercise. Take care to avoid infinite looping!
//write a do-while loop that does the same.
// write an enhanced for loop that iterates over this array and prints the result of that number modulus(%) 3
/*
Some activities for String methods
*/
// Create two String variables, one holding "Hello" and one holding "world"
// using String methods, concatenate these strings together with a space between them so that it reads "Hello world" and save the resulting String to a new variable
// then, create a for loop that iterates over your new String and prints each letter out using sout
/*
Combination Exercises
*/
// Create a variable that stores a String with the value "Testing out String methods"
// Use the String's .split() method with the input of '\s' save an array containing each word of your String variable
// Using a loop of your choosing, loop through the array of strings and print each word to the screen in all caps, along with its length
// CHALLENGE: search the Oracle Documentation to find out how to sort an array, then print the sorted array to the string
}
}