Wednesday, December 31, 2014

Java Tutorial For Beginners 23 - Public, Private, Protected and this (Ja...











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
package lesson1;
/*Access Levels
Modifier Class Package Subclass World
public          Y      Y  Y           Y
protected   Y     Y         Y               N
no modifier   Y      Y   N           N
private           Y  N   N           N
*/
public class Student {
 private String name;
 private int age;
 
 public String getName() {
  return name;
 }
 public void setName(String name) {
  this.name = name;
 }
 public int getAge() {
  return age;
 }
 public void setAge(int age) {
  this.age = age;
 }

}



public class MyClass {

 public static void main(String[] args) {
  Student stu = new Student();
  stu.setName("mark");
  System.out.println(stu.getName());
 }
    
}












package protected java

java package visibility

java protected visibility

java class visibility

java default public private

java method visibility

java default protected

java protected vs default

java access modifiers example

java access modifiers inheritance

java non access modifiers

java final

java access modifiers for class

java access modifiers matrix

java access modifiers package-private

java access modifiers


IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ