shilf wrote:
why f() within class A can be used directly in Main(),but we must create object a to use g()?
This is because f() is static and does not require that an instance of an object to access it.
shilf wrote:
the same;why y within class OuterClass can be used directly in nested NestedClass,but we must create object b to use x?
AFAIK, the inner class is aware of the outer class variables and not vice versa.
It is good that you are trying out such samples and trying to learn the grammar of a language in depth.
However, I would recommend that you get a book and read it or try to search on msdn before posting such questions on a website.