My question is how can I write setter/getter methods and static fields in an interface and implement it in another class.

An example:

public interface MyInterface {
int number = 0;

public int setNumber(int num);{

 }
}

// Use it

public MyClass implements MyInterface{

 ...

public int setNumber(int num) {
   number = num;   // Error, Why?
 }
}

I get error on number = num but it get no error in the setName(...) method!

Edit
Report