Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Public is a keyword that is used as an access modifier for methods and variables. A variable (field) or a method declared as public is visible to and may be accessed by all classes defined in different packages.
The public keyword is used in many object-oriented programming languages (OOPL), including C++, Java, C# and Visual Basic.NET (VB.NET). A public member is loosely bound to a class and less restrictive than a private member. Variables or fields that are declared public have no accessibility restrictions. A private member, however, is only visible in its class.