The blog post on the website javatpoint.com discusses the concept of access modifiers in the programming language Java. Access modifiers are keywords in Java that are used to specify the level of access that a class, method, or variable has.
There are four types of access modifiers in Java: - Public - Private - Protected - Default The public access modifier allows a class, method, or variable to be accessed from anywhere, while the private access modifier limits access to only within the same class. The protected access modifier allows access from the same package and all subclasses, while the default access modifier allows access only within the same package.
The blog post goes on to give examples of how these access modifiers can be used in practice. For instance, it shows how a public class can be accessed from any other class, while a private method can only be accessed within the same class. It also explains how the protected access modifier can be used to allow access to a variable or method from a subclass, even if it is in a different package.
Additionally, the post explains about static and final keywords which are also considered access modifiers. Static keyword is used to create a single copy of a variable or method that is shared among all instances of a class, while the final keyword is used to make a variable or method constant, meaning that its value cannot be changed.
In conclusion, the blog post provides a comprehensive overview of the concept of access modifiers in Java and how they can be used to control the level of access that a class, method, or variable has. It explains the different types of access modifiers and provides examples of how they can be used in practice. It also covers a brief about static and final keyword which are considered as access modifiers.
After visiting this story, if you enjoyed it, please show the author some love by coming back and clicking Like button and leaving a comment.
No comments yet, be the first one to post comment.