Q:

Kotlin program to print Kotlin, JVM version (printing Java properties)

belongs to collection: Kotlin Basic Programs

0

Here, we will create a Kotlin program to print Kotlin, JVM version (printing Java properties). As Kotlin can be seen as an upgrade of Java, so we will get all versions of java (JVM) using Kotlin also.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program to print Java System properties in Kotlin

package com.includehelp.basic

// Main Function Entry Point of Program
fun main(args: Array<String>) {
    println("Kotlin Version  : ${KotlinVersion.CURRENT} ")

    println("Java Version     : ${ System.getProperty("java.version") } ")
    println("Java VM Version  : ${ System.getProperty("java.vm.version") } ")
    println("Java VM Vendor   : ${ System.getProperty("java.vm.vendor") }  ")
    println("Java VM Name     : ${ System.getProperty("java.vm.name")  } ")
    println("Java VM specification Version : ${ System.getProperty("java.vm.specification.version") }" )
    println("Java VM specification Vendor  : ${ System.getProperty("java.vm.specification.vendor") }" )
    println("Java VM specification Name    : ${ System.getProperty("java.vm.specification.name") }" )
    println("Java Runtime specification Version : ${ System.getProperty("java.specification.version") }" )
    println("Java Runtime specification Vendor  : ${ System.getProperty("java.specification.vendor") }" )
    println("Java Runtime specification Name    : ${ System.getProperty("java.specification.name") }" )
}

Output

Kotlin Version  : 1.3.71
Java Version     : 1.8.0_66
Java VM Version  : 25.66-b18
Java VM Vendor   : Oracle Corporation
Java VM Name     : Java HotSpot(TM) 64-Bit Server VM
Java VM specification Version : 1.8
Java VM specification Vendor  : Oracle Corporation
Java VM specification Name    : Java Virtual Machine Specification
Java Runtime specification Version : 1.8
Java Runtime specification Vendor  : Oracle Corporation
Java Runtime specification Name    : Java Platform API Specification

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Kotlin Basic Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
<< Kotlin program to generate 4 digits OTP...