In the Main class I have the followingpublic class test { public static void main(String args[]){ String separ; String lin = "/"; String wind = "\\"; String s = System.getProperty("file.separator"); if (s != wind) FileSeparatorExample.separator = lin; else FileSeparatorExample.separator=wind; System.out.println(FileSeparatorExample.a); } }
in the another class
public class FileSeparatorExample { /** * @param args the command line arguments */ public static String separator; public static String a ; public FileSeparatorExample(){ this.a = FileSeparatorExample.separator; } public static void lodA(){ a = separator; return ; } }
Why System.out.println(FileSeparatorExample.a);
return me "null"
how to fix?
I am a new in java, please help me!!!
Thanks