In which area of a class are data and function directly accessible outside the class?
Answers
Answered by
1
when these are publically declared
Answered by
2
In a Public class are data and function directly accessible outside the class
Explanation:
- 'Public' is a keyword which acknowledges a member's access as 'public'. 'Public' members are always accessible to all other 'classes'. It implies that any other 'class' may have access to a 'public' field or method. Additionally, other 'classes' can change 'public' fields except the field is declared 'final'.
- The best approach is to give the field's 'private' access and restrict 'public' access to only the set of 'methods' and 'final' fields that define the class 'public' constants.
To know more
What is the significance of public class in a package?
https://brainly.in/question/1446815
Difference between public class s{ } and class s{ } in java?
https://brainly.in/question/8885697
Similar questions