當前位置:
首頁 >
kotlin获取属性_Kotlin程序获取系统名称
發布時間:2025/3/11
31
豆豆
生活随笔
收集整理的這篇文章主要介紹了
kotlin获取属性_Kotlin程序获取系统名称
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
kotlin獲取屬性
The task is to get the system name.
任務是獲取系統名稱。
package com.includehelpimport java.net.InetAddress/*** Function for System Name*/ fun getSystemName(): String? {return try {InetAddress.getLocalHost().hostName} catch (E: Exception) {System.err.println("System Name Exp : " + E.message)null} }//Main function , Program Entry Point fun main(args: Array<String>) {// Call Function to get Computer System Nameval systemName = getSystemName()// Print Computer Nameprintln("Computer Name : $systemName") }Output
輸出量
Computer Name : DESKTOP-16EO58R翻譯自: https://www.includehelp.com/kotlin/get-system-name.aspx
kotlin獲取屬性
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的kotlin获取属性_Kotlin程序获取系统名称的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: qgis在地图上画导航线_在Larave
- 下一篇: 操作系统中的死锁_操作系统中的死锁介绍