Added a 'More Information' with Java Doc links (#19619)

This commit is contained in:
Le Phan
2018-10-21 09:56:34 -05:00
committed by Tom
parent b9cb03252f
commit c94541d2d3

View File

@ -82,3 +82,7 @@ System.out.println("Full Car Model X= " + modelX.getManufacturerName() + " : " +
So, `Car` is a class, which has the fields or properties `name` and `manufacturerName`. `modelS` is an object of `Car` class. So `modelS` also has the same properties and methods.
It is pretty much standard to ensure the object's 'information', in this case the `name` an `manufacturerName` variables, to be private and only be accessed via these getters and setters. This prevents an issue with debugging code that involves an object's member variables. If the member variables were made public, and for whatever reason the program crashes, you could get a rather complex stack trace that may be difficult to point out the error. Keeping the variables private, and only accessible via getters and setters, will simplify this error message down.
### More Information:
- [Oracle Java Docs :Classes](https://docs.oracle.com/javase/tutorial/java/javaOO/classes.html)
- [Oracle Java Docs :Objects](https://docs.oracle.com/javase/tutorial/java/javaOO/objects.html)