當(dāng)前位置:
首頁(yè) >
kotlin获取属性_Kotlin程序获取系统名称
發(fā)布時(shí)間:2025/3/11
21
豆豆
生活随笔
收集整理的這篇文章主要介紹了
kotlin获取属性_Kotlin程序获取系统名称
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
kotlin獲取屬性
The task is to get the system name.
任務(wù)是獲取系統(tǒng)名稱。
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獲取屬性
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的kotlin获取属性_Kotlin程序获取系统名称的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: qgis在地图上画导航线_在Larave
- 下一篇: node.js 中间件_Node.js中