Skip to content

Commit c78be8a

Browse files
committed
Program on Java
1 parent e66fe86 commit c78be8a

File tree

9 files changed

+116
-0
lines changed

9 files changed

+116
-0
lines changed

src/src.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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="jdk" jdkName="1.8" jdkType="JavaSDK" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>

src/src/Break.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Created by PC on 07.06.2017.
3+
*/
4+
public class Break {
5+
public static void main(String[] args) {
6+
label1: for (int i = 0; i < 10; i++)
7+
{
8+
if (i == 5) break label1;
9+
System.out.println(i);
10+
}
11+
}
12+
}

src/src/Continue.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Created by PC on 07.06.2017.
3+
*/
4+
public class Continue {
5+
public static void main(String[] args) {
6+
int i = 0;
7+
8+
label1:
9+
10+
while (i < 10) {
11+
i++;
12+
System.out.println("Hello");
13+
if (i == 5) continue label1;
14+
System.out.println("World");
15+
}
16+
}
17+
}

src/src/DoWhile.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Created by PC on 07.06.2017.
3+
*/
4+
public class DoWhile {
5+
public static void main(String[] args) {
6+
int i = 0;
7+
do {
8+
System.out.println(i++);
9+
10+
}while (i < 10);
11+
}
12+
}

src/src/For.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Created by PC on 07.06.2017.
3+
*/
4+
public class For {
5+
public static void main(String[] args) {
6+
for (int i = 0; i < 10; i++)
7+
{
8+
System.out.println(i);
9+
}
10+
}
11+
}

src/src/ForEach.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.Arrays;
2+
import java.util.List;
3+
4+
/**
5+
* Created by PC on 07.06.2017.
6+
*/
7+
public class ForEach {
8+
public static void main(String[] args) {
9+
List<Integer> list = Arrays.asList(7, 10, 1, 5, 2);
10+
list.forEach(item -> System.out.println(String.format("%s, %s, %s",item,list.indexOf(item),list.toString())));
11+
System.out.println();
12+
list.forEach(System.out::print);
13+
System.out.println();
14+
list.forEach(x -> System.out.print(x));
15+
}
16+
}

src/src/ForOf.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Created by PC on 07.06.2017.
3+
*/
4+
public class ForOf {
5+
public static void main(String[] args) {
6+
for (int elem: new int[]{7, 10, 1, 5, 2})
7+
{
8+
System.out.println(elem);
9+
}
10+
}
11+
}

src/src/Map.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import java.util.Arrays;
2+
import java.util.function.Function;
3+
4+
/**
5+
* Created by PC on 07.06.2017.
6+
*/
7+
public class Map {
8+
public static void main(String[] args) {
9+
10+
Function<Integer,Void> log = s -> {System.out.println(s); return null;};
11+
Arrays.stream(new Integer[]{7, 10, 1, 5, 2}).map(x -> x * 2).map(log);
12+
}
13+
}

src/src/While.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Created by PC on 07.06.2017.
3+
*/
4+
public class While {
5+
public static void main(String[] args) {
6+
int i = 0;
7+
while (i<10)
8+
{
9+
System.out.println(i);
10+
i++;
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)