A note to help you in future endeavors. When doing conditionals (including loops where applicable), its often easier to debug when placing comparison values that cannot change on the left side of the check.
Take the below code for example. It does do a check but after it sets the value of 10 to the variable i. Use double equals for equality checking.
if (i = 10)
However the point I want to make is if you placed the non changeable value on the left, the compiler will yell at you for mistakes like this.
if (10 = i)
if (10 == i)
I do this will most conditionals, including null checks as the same thing would occur for that. It cannot be 'set' to anything, so compiler exception is thrown.
And as Dave and Richard have said, getting a good book and/or going through some tutorials may help you debug your issues.