Skip to content

Commit ad1e9d2

Browse files
BryzzBryzz
Bryzz
authored and
Bryzz
committed
print 1 2 3 4. closes DSC-UB#2
1 parent b377d17 commit ad1e9d2

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>
12+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.bryzz.dsc;
2+
3+
public class DisplayNumbers {
4+
5+
public static void main(String[] args) {
6+
System.out.println("\n1 - 4 using one System.out.println()");
7+
onePrintln();
8+
9+
System.out.println("\n\n1 - 4 using four System.out.print()");
10+
fourPrintln();
11+
12+
System.out.println("\n\n1 - 4 using four System.out.printf()");
13+
printf();
14+
}
15+
16+
public static void onePrintln() {
17+
System.out.println("1 2 3 4");
18+
}
19+
20+
public static void fourPrintln() {
21+
int i = 1;
22+
for(i=1; i<=4; i++) {
23+
System.out.print(i + " ");
24+
}
25+
26+
}
27+
28+
public static void printf() {
29+
System.out.printf("%d %d %d %d",1, 2, 3, 4);
30+
}
31+
}
32+

0 commit comments

Comments
 (0)