diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index f1a4dc45..383838e1 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -1,9 +1,9 @@ name: Code Formatter -on: [push] +on: [push, pull_request] jobs: - lint: + checkstyle: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1418aa04..4e646fd0 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -3,7 +3,7 @@ name: Java CI with Gradle -on: [push] +on: [push, pull_request] jobs: build: diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 967af3e5..63712cfe 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -3,7 +3,7 @@ name: Java CI with Maven -on: [push] +on: [push, pull_request] jobs: build: diff --git a/.gitignore b/.gitignore index 85543c50..5f62faa6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .gradle /build/ .idea/ +target # Ignore Gradle GUI config gradle-app.setting diff --git a/src/main/java/com/examplehub/basics/ForLoop.java b/src/main/java/com/examplehub/basics/ForLoop.java index 7a106b48..9f299b41 100644 --- a/src/main/java/com/examplehub/basics/ForLoop.java +++ b/src/main/java/com/examplehub/basics/ForLoop.java @@ -66,6 +66,32 @@ public static void main(String[] args) { } System.out.println("\n"); + /* + * 1 2 3 4 5 + */ + int x = 0; + while (true) { + x++; + System.out.print(x + ""); + if (x == 5) { + break; + } + } + System.out.println(); + + /* + * 1 2 3 4 5 + */ + int i = 0; + do { + i++; + System.out.print(i + ""); + if (i == 5) { + break; + } + } while (true); + System.out.println(); + /* infinite loop */ /* for (; ; ) {