this is strange coming from Java,how come you can't initialize a static variable inside the class or struct yet how come you can do it outside the class it makes little sense to me?
Static members of a class are not associated with the objects of the class: they are independent objects with static storage duration or regular functions defined in namespace scope, only once in the program.
A non-inline function can be declared in a header, that header included in many files, but function definition can only appear in one file. Define it in two files and the linker won't know which function to call.
A non-constexpr (and as of C++17 non-inline) static member is declared as part of a class definition, and that definition may appear in a header, included in many files. But if the static member were defined in more than one file, the linker won't know which memory location to use when code reads and writes to that member, and what &ex::count would produce.
a property is declared static when it is to be shared by other objects of a class as such it doesnt belong to a single object so... in other words, by initializing it outside the class u show that it doesnt belong to a single object of that class.