lets say I have a class
class A
{
public int x;
static int y;
}
now the differences:
to use public variable i have to have objects created so
A a = new A();
int num = a.x;
on the other hand static variables are at class level so I can be used as
int num = A.y;
or
A a = new A();
int num = a.y;
ALso the static variable retain the values for all objects of the class. to illustrate lets see this:
A a1 = new A();
A a2 = new A();
a1.x = 3;
a2.x = 5;
Console.Write(a1.x);
Console.Write(a2.x);
a1.y = 3;
Console.Write(a1.y);
Console.Write(a2.y);
a2.y = 5;
Console.Write(a1.y);
Console.Write(a2.y);
On the closing note, we should never use public member variables, we should always use private variables encapsulated inside properties or methods. on the other hand static variables might be required in a class.
Note: code here is for demonstration purpose, might contain come errors as I have not compiled it. ALso this is not the complete explanation. it is just the basic explanation. i suggest reading more about this to understand these things fully.