When no modifier is stated - it's considered to be *default* aka as package
private.

http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

A sample of code will be helpful for your second question but my guess will
be for clarity of code or logic.

Thanks
Gagan

On Tuesday, May 26, 2015, Danielle Livneh <[email protected]> wrote:

> Are variables by default public or private in java classes? Also I'm a bit
> confused why it would be necessary to use "this" since the methods (a
> getter method for example) have access to the variables anyway
>
> --
> You received this message because you are subscribed to the Google Groups
> "JPassion.com: Java Programming" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at http://groups.google.com/group/jpassion_java.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/d/optout.

Reply via email to