-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintro6.html
More file actions
96 lines (68 loc) · 3.95 KB
/
intro6.html
File metadata and controls
96 lines (68 loc) · 3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<html>
<head>
<link type="text/css" rel="stylesheet" href="example.css"></link>
</head>
<body bgcolor="" >
<ul id="u1">
<li id="l1"><a class="ac" href="Home.html" id="a1"><b>Home</b></a></li>
<li id="l1"><a href="AboutUs.html" id="a2"><b>About Us</b></a></li>
<li id="l1"><a href="#contact" id="a2"><b>History of Java</b></a></li>
<li id="l1"><a href="#about" id="a2"><b>Objectives</b></a></li>
</ul>
<table>
<tr>
<td align="left" valign="top">
<a href="intro.html"><img src="image/jj.jpg" width="150" height="150"></a><br>
<a href="intro2.html"><img src="image/j2.jpg" width="150" height="150"></a><br>
<a href="intro8.html"><img src="image/j3.jpg" width="150" height="150"></a><br>
<a href="intro3.html"><img src="image/j4.jpg" width="150" height="150"></a><br>
<a href="intro4.html"><img src="image/j5.jpg" width="150" height="150"></a><br>
<a href="intro5.html"><img src="image/j6.jpg" width="150" height="150"></a><br>
<a href="intro6.html"><img src="image/j7.jpg" width="150" height="150"></a><br>
<a href="intro7.html"><img src="image/j8.jpg" width="150" height="150"></a><br>
</td>
<td align="left" valign="top">
<pre>
<center><font face="Times New Romance" size="8" color="blue">Access Modifiers or Visibility Controls</font></center>
<font face="Times New Roman" size="4">
These are also Called as Access Visibility Controls means they defined where a method
and Data Member of class will be used either inside a class ,outside a class ,in inherited
class or in main Method They Tells us the Scope of Methods where they would be used Various
types of Access Modifiers are as follows:-
1) Public Access: - Public Access modifiers Specifies that data Members and Member
Functions those are declared as public will be visible in entire class in which they
are defined. Public Modifier is used when we wants to use the method any where either
in the class or from outside the class.
2) Protected Access:- The Methods those are declared as Protected Access modifiers are
Accessible to Only in the Sub Classes but not in the Main Program , This is the Most
important Access Modifiers which is used for Making a Data or Member Function as he
may only be Accessible to a Class which derives it but it doesn’t allows a user to
Access the data which is declared as outside from Program Means Methods those are
Declared as Protected are Never be Accessible to Another Class The Protected will
be Accessible to Only Sub Class and but not in your Main Program.
3) Private Access:- The Methods or variables those are declared as private Access
modifiers are not would be not Accessed outside from the class or in inherited Class
or the Subclass will not be able to use the Methods those are declared as Private
they are Visible only in same class where they are declared. By default all the
Data Members and Member Functions is Private, if we never specifies any Access
Modifier in front of the Member and Data Members Functions.<br>
Example
<a href="W.html">Class Student has private fields as student number and name.The method
display() in class Student displays as student number and name. Use constructor to
assign values. Write a java program to set and display values of one student.</a><br>
Example
<a href="X.html">Class Employee has protected fields number and name.Class laborer
has a private field number of ot hours. The class also have a public method set()
which set number, name and ot hours and a method show() which displays number
and name of a laborer. Write a java program to set and display data of a laborer.</a>
</font>
</td>
<td align="right" valign="top">
.<br><br><br><br><br><br>
<img src="image/png;base649391a5ca185fedfc.png" width="400" height="350"><br><br><br><br><br><br><br><br><br>
<img src="image/java-member-access-levels1.png" width="300" height="250">
</td>
</tr>
</table>
</body>
</html>