To understand the difference, it always helps to read out your condition statement in english.
if ( !name.equals("abc") || !name.equals("cba") )
Translates to
If name does not equal “abc” OR name does not equal “cba”, then…
Whereas,
if ((!(name.equals("abc") || name.equals("cba") )))
If (name equals “abc’ OR name equals “cba” ) IS FALSE, then…
or, by Boolean Logic,
If name does not equal “abc” AND name does not equal “cba”, then…
The two are definitely not the same.
solved Java not equals with OR