Public or Private in programming?

Write,explaining when you would use public and when you would use private in programming. Give examples.