0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

IntelliJ IDEA の使い方

Last updated at Posted at 2023-10-24

Ubuntu 23.10 にインストールして使ってみました。

インストール

sudo snap install intellij-idea-community --classic

起動

intellij-idea-community

File -> New -> Project
image.png

Console Application にします。
JDK のバージョンは、21 にして下さい。

image.png

image.png

プログラム

Main.kt
fun main(args: Array<String>) {
    println("Hello World!")

    // Try adding program arguments via Run/Debug configuration.
    // Learn more about running applications: https://www.jetbrains.com/help/idea/running-applications.html.
    println("Program arguments: ${args.joinToString()}")
}

実行

image.png

実行結果

image.png

Hello World!
Program arguments: 

Process finished with exit code 0

プログラムを複雑にします。

Main.kt
fun main(args: Array<String>) {
    println("*** start *** Nov/03/2023 ***")
    val ax : ArrayList<Double> = arrayListOf()

    var nn = 0
    val nmax = 50
    for (it in 1..nmax){
        for (jt in it..nmax){
            val itjt2 = it*it + jt * jt
            for (kt in jt..nmax){
                val kt2 = kt * kt
                if (itjt2 == kt2){
                    val ratio = it.toDouble() / jt.toDouble()
                    if (!ax.contains(ratio)){
                        val outstr = "" + nn + "\t" + it + "\t" + jt + "\t" + kt + "\t" + ratio
                        println(outstr)
                        ax.add(ratio)
                        nn += 1
                    }
                    }
                }
            }
        }

    println()
    println(ax)
    println("*** end ***")
}

実行結果
image.png

/home/uchida/.jdks/openjdk-21.0.1/bin/java -javaagent:/snap/intellij-idea-community/464/lib/idea_rt.jar=34231:/snap/intellij-idea-community/464/bin -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath /home/uchida/IdeaProjects/nov0301/out/production/nov0301:/home/uchida/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.0/kotlin-stdlib-jdk8-1.9.0.jar:/home/uchida/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.9.0/kotlin-stdlib-1.9.0.jar:/home/uchida/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-common/1.9.0/kotlin-stdlib-common-1.9.0.jar:/home/uchida/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/home/uchida/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.0/kotlin-stdlib-jdk7-1.9.0.jar MainKt
*** start *** Nov/03/2023 ***
0	3	4	5	0.75
1	5	12	13	0.4166666666666667
2	7	24	25	0.2916666666666667
3	8	15	17	0.5333333333333333
4	9	40	41	0.225
5	12	35	37	0.34285714285714286
6	20	21	29	0.9523809523809523

[0.75, 0.4166666666666667, 0.2916666666666667, 0.5333333333333333, 0.225, 0.34285714285714286, 0.9523809523809523]
*** end ***

Process finished with exit code 0
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?