Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+25 votes
asked in CSC211_Winter2018 by (8 points)

2 Answers

+9 votes

public means you can access it from any other class, classes are objects that have different attributes like using strings, int, boolean and double for example, you have public class CarBrands{ // This is your public class it has public class, the object and the name of the object.
When you open up and eclipse it will always start with a public class HelloWorld.

answered by (8 points)
+9 votes

Public classes can be incredibly helpful when something (a method) is occurring multiple times throughout a program. This can help reduce redundancy in your code, as well as saving time and energy that typing or reading such repetitious code can use up. Of course, using comments to explain what each method does can also reduce the need to comment on every line in the main method.

answered by (8 points)