I found the solution forto the problem. I just had to add single line of code to make this work.
MyClass object= PageFactory.initElements(driver, MyClass.class);
I had to add this code to the class where I was creating the test and tried. It worked. The Error wasn't in using of "@FindBy"@FindBy. So I guess this will help someone in the future.