HI,
I want to use same methods specific to OS but when I am trying to do so,I am only able to find out the OS name but it is not going inside that.I wrote a simple code as below --
and Output ispublic class OSnane {
public static void main(String[] args) {
String OsName=null;
OsName=System.getProperty("os.name");
System.out.println("OS name="+OsName);
if(OsName == "SunOS")
System.out.println("hello Sun");
else if(OsName == "Windows XP")
System.out.println("Hello Windows");
else if(OsName == "Linux")
System.out.println("Hello Linux");
else
System.out.println("No OS selected!!!");
}
}
So how can I use the method based on the OS..OS name=SunOS
No OS selected!!!
Thanks in advance....


Reply With Quote



Bookmarks