<em>using the private access specifier on the class methods </em>
<h2>Further explanation
</h2>
Java is an OOP (Object Oriented Programming) paradigm programming language that can be run on computers with 32-bit or 64-bit systems. One software that operates the Java programming language is NetBeans IDE 7.2.
Private is the code that matches the name, this access is private. in other words, data and methods can only be accessed by the class they have.
Protected is an access code that makes a data or method that is defined with this level of access can be accessed by classes that have it only and also classes that include having descendants or Encapsulation data
Private Access
<em>public class StudentRecord
</em>
<em>{
</em>
<em> // basic access to variables
</em>
<em> private int name;
</em>
<em>
</em>
<em> // basic access to the method
</em>
<em> private String getName () {
</em>
<em> return name;
</em>
<em> }
</em>
<em>}
</em>
<em>
</em>
In the example above, the variable name and the method getName () can only be accessed by the internal methods of the class.
Protected Access
<em>public class StudentRecord
</em>
<em>{
</em>
<em> // access to variables
</em>
<em> protected int name;
</em>
<em>
</em>
<em> // basic access to the method
</em>
<em> protected String getName () {
</em>
<em> return name;
</em>
<em> }
</em>
<em>}
</em>
In the example above, the variable name and the getName () method can only be accessed by internal class methods and subclasses of the StudentRecord class.
Learn More
private protected in Javascript brainly.com/question/13133829
method and class in javascript brainly.com/question/13148975
Details
Class: High School
Subject: Computers and Technology
Keywords: javascript, private access, protected