THIS VIDEO IS BASED ON java programming with visual studio Example to understand the behavior of the access modifiers.
The following code is written below: class Person{
private int salary = 5000;
public String name = "Jack";
protected int age = 24;
String email = "[email protected]";
public void display(){
System.out.println("Name: " + name);
System.out.println("Age: " + age);
System.out.println("Email: " + email);
System.out.println("Salary: " + salary);
}
}
class Employee extends Person {
public void display(){
System.out.println("Name: " + name);
System.out.println("Age: " + age);
System.out.println("Email: " + email);
}
}
class Customer {
public void display(){
Person p = new Person();
System.out.println("Name: " + p.name);
System.out.println("Age: " + p.age);
System.out.println("Email: " + p.email);
}
}
class Execute{
public static void main (String[] args) {
Person p = new Person();
Employee e = new Employee();
Customer c = new Customer();
System.out.println("******************************");
System.out.println("Person Class display method.");
System.out.println("******************************");
p.display();
System.out.println("******************************");
System.out.println("Employee Class display method.");
System.out.println("******************************");
e.display();
System.out.println("******************************");
System.out.println("Customer Class display method.");
System.out.println("******************************");
c.display();
}
}
On this page of the site you can watch the video online java programming with visual studio code with a duration of hours minute second in good quality, which was uploaded by the user Narayan Guha 01 January 1970, share the link with friends and acquaintances, this video has already been watched 12 times on youtube and it was liked by 0 viewers. Enjoy your viewing!