24.Private Methods


#1



Replace this line with your code.

I am slowly getting the idea behind this but I am struggling with the utility of this. What scenario would you even use this.
Maing a method private, only to create a public method to access it (essentiallly making it public again). It seems redundant


#2

Yea you would use private methods when you dont want other classes "accidently changing the value".

Private methods are useful for breaking tasks up into smaller parts, or for preventing duplication of code which is needed often by other methods in a class, but should not be called outside of that class.

This stackoverflow question will help you a lot: