获取android系统信息

本文介绍如何使用Java的System类来获取操作系统的名称和版本等系统属性,并提供了详细的代码示例及解释。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

eg.

 

 

System.out.println("os.name "+System.getProperty("os.name"));
System.out.println("os.version "+System.getProperty("os.version"));
 

 

SDK帮助文档

java.lang.System
public static String getProperty (String prop)

 

Since: API Level 1

Returns the value of a particular system property or null if no such property exists.

The properties currently provided by the virtual machine are:

        java.vendor.url
        java.class.path
        user.home
        java.class.version
        os.version
        java.vendor
        user.dir
        user.timezone
        path.separator
        os.name
        os.arch
        line.separator
        file.separator
        user.name
        java.version
        java.home
 

 

Parameters
propthe name of the system property to look up.
Returns
  • the value of the specified system property or null if the property doesn't exist.
Throws
SecurityExceptionif a SecurityManager is installed and its checkPropertyAccess() method does not allow the operation.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值