Not able to execute the method based on OS in JAVA

Hi,

In my application,I want to find out the OS name and based on OS I want to do some specific operations.So I write some code based on it in JAVA but I am able to get the OS name but Not able to use the method specific to OS.I write a simple code to check it and found that it is not going to the if statement.code is as follow--

and the Output is:

So please tell me how can I Use methods based on OS.
Thanks in Advance ...

Please consider taking some time for some readings to consolidate your Java knowledge. You don't use equality (==) for string equality tests. You must use the String.equals() method.

e.g. osName.equals("SunOS")

By using == you were comparing two object references and expectedly the equality is false.