"Hello World" in Java

<!-Title: "Hello World" in Java->

Introduction

For studying, I implemented "Hello World" in various languages.

Java.

environment

Visual Studio Code (Windows version)

Windows Subsystem for Linux (Ubuntu 18.04 LTS)

javac 1.8.0_181 openjdk 10.0.2 2018-07-17

Hello World

HelloWorld.java


public class HelloWorld {
    public HelloWorld(int count) {
        this.count = count;
    }

    private int count;

    private void sayOnce(Integer value) {
        System.out.println("Hello, world. " + value.toString());
    }

    public void say() {
        for (int i = 0; i < this.count; i++) {
            sayOnce(i);
        }
    }

    public static void main(String[] args) {
        HelloWorld hw = new HelloWorld(10);

        hw.say();
    }
}

Output result

Hello, world. 0
Hello, world. 1
Hello, world. 2
Hello, world. 3
Hello, world. 4
Hello, world. 5
Hello, world. 6
Hello, world. 7
Hello, world. 8
Hello, world. 9

Impressions

I finished it in a similar way to C ++.

I haven't touched Java itself so much, but I use C # a lot, so I could write it without any discomfort.

Recommended Posts

"Hello World" in Java
Hello World in Java
Java, Hello, world!
Java Hello World
Hello World in java in eclipse now
Hello world in Java and Gradle
Java Learning (1)-Hello World
Hello world in node.js
Java history in this world
java hello world, compile, run
Display "Hello World" in the browser using Java
Display "Hello World" in the browser using Java
Java beginners read Hello World
Spring Boot Hello World in Eclipse
Hello World for ImageJ Java Plugin
Hello World on AWS Lambda + Java
hello, world in Vanilla Java-EHW2018 "MVP"
Partization in Java
Changes in Java 11
Rock-paper-scissors in Java
Read "Hello world"
Hello Java Lambda
Pi in Java
FizzBuzz in Java
Hello, World! In the bootstrap loader area
Hello world with Java template engine Thymeleaf
[Practice! ] Display Hello World in Spring Boot
Java development with Codenvy: Hello World! Run
"Hello, World!" With Kotlin + CLI in 5 minutes
Hello World on Mac VS Code Java
Minimal Java environment construction and Hello World
Compare Hello, world! In Spring Boot with Java, Kotlin and Groovy
[java] sort in list
Read JSON in Java
Interpreter implementation in Java
Make Blackjack in Java
Output Hello World in kotlin's simple main function
Rock-paper-scissors app in Java
Constraint programming in Java
Put java8 in centos7
NVL-ish guy in Java
Combine arrays in Java
Callable Interface in Java
Hello World with JavaFX 11 (OpenJFX) in Liberica JDK 11
Comments in Java source
Azure functions in java
Build Java environment and output hello world [Beginner]
Read System.out.println ("hello, world")
Let's write Hello World
Format XML in Java
Simple htmlspecialchars in Java
Boyer-Moore implementation in Java
Use OpenCV in Java
webApi memorandum in java
Type determination in Java
Ping commands in Java
Studying Java-Part 1-Hello World
Various threads in java
Heapsort implementation (in java)
Zabbix API in Java
[Java] Hello World with Java 14 x Spring Boot 2.3 x JUnit 5 ~