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 --

public class OSnane {

public static void main(String[] args) {

String OsName=null;

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");
System.out.println("No OS selected!!!");


and Output is

OS name=SunOS
No OS selected!!!
So how can I use the method based on the OS..

Thanks in advance....