Split character and read properties file, split properties
In the method, create the properties object Properties pps = new Properties (); call. load () method pps. load (new FileInputStream ("E: \ workplace \ testStudent \ src \ we. properties "); the entire method is public static String getValueByKey (String key) {Properties pps = new Properties (); try {pps. load (new FileInputStream ("E: \ workplace \ testStudent \ src \ we. properties ");} catch (IOException e) {// TODO Auto-generated catch blocke. printStackTrace ();} return (String) pps. get (key); create the main method to test public static void main (String [] args) {int a = 0; String category = Constant. getValueByKey ("UIConfig. category "); String [] categoryvalue = category. split ("\\|"); for (String str: categoryvalue) {String [] test = str. split ("\:"); System. out. println (test [1]); System. out. println (test [0]) ;}}