Use ResourceBundle to read resource allocation information

2023-03-17  

Note: Fileapple.propertiesneed to be placed in the SRC root directory

apple.properties file content:

deviceName_meizu=85GBBMA2353T
deviceName_huawei=022TAS7N51009853
deviceName_oppo=NFNNP78T99999999
deviceName_redmi=fd327d02

code execution:

    public static void main(String[] args) {
        // Note: The file does not need to be added with a file suffix name
        ResourceBundle rb = ResourceBundle.getBundle("apple");
        String s = rb.getString("deviceName_meizu");
        System.out.println(s);
    }

execute results:

85GBBMA2353T

source

Random Posts

Kinect Development Tips: Cross the Azeroth, tease the Red Dragon Queen

[C ++ Thinking Maps and Code Example] 11 an exception processing mechanism

Unity guidance bag lost TAG value, layer value

OPENCV source code+CUDA+CUDNN compilation (Ubuntu+Windows) KYH

Ubuntu cracked password (Ubuntu-20.04-Server)