forked from LaunchCodeEducation/java-exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoops.java
More file actions
33 lines (24 loc) · 817 Bytes
/
Copy pathLoops.java
File metadata and controls
33 lines (24 loc) · 817 Bytes
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
package org.launchcode.java.demos;
/**
* Created by LaunchCode
*/
public class Loops {
public static void main(String[] args) {
System.out.println("printZeroToTen :: ");
printZeroToTen();
System.out.println("printCharactersFromAString :: ");
printCharactersFromAString();
}
// Print integers from 0 to 10
public static void printZeroToTen() {
for (int i = 0; i < 11; i++) {
System.out.println(i);
}
}
public static void printCharactersFromAString() {
String text = "Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book...";
for (char c : text.toCharArray()) {
System.out.print(c);
}
}
}