Java Java Objects Harnessing the Power of Objects Filling the Dispenser

Florentin Dumitrache
Florentin Dumitrache
3,757 Points

private vs public final

What is the difference between these two? From what i've seen both protect the value and give an error when the program is compilated.

1 Answer

Frank Torchia
PRO
Frank Torchia
Pro Student 16,903 Points

A public variable is accessible everywhere in the code while a private variable is only available in the class where it is declared.