Question : java or condition exeption

I have following code but i'm getting error where OR condition is

Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
        String OS = System.getProperty("os.namE").toLowerCase(); 
    	if (OS.indexOf("Vista") != -1)
          || (OS.indexOf("Windows 7") != -1) {
    		System.out.println("You using NT 6.0 Platform"); 

    	} else {
    		System.out.println("You using NT 5.0 or older plaform");
    	} 
}

Answer : java or condition exeption

For good coding practice, variable name should start with lowercase characters. Also, your comparison should be:

String os = System.getProperty("os.name").toLowerCase();
if (os.indexOf("vista") != -1 || os.indexOf("windows 7") != -1) {
...

Random Solutions  
 
programming4us programming4us