Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: How to use the protected keyword

Java: How to use the protected keyword
{filelink=11045}

public class Person
 {
  private String name;
  private double salary;
  public Person(String nm, double sal)
   {
      name=nm;
      salary=sal;
   }
  // This method is only available to subclasses of "Person" class
  protected void modifier_Salaire(double new_salary)
  {
    salary =new_salary;
  }
  public double getSalaire()
  {
  	return salary;
  }
}

Users who found this page were searching for:

  • protected keyword is use in java?

No comments yet.

Leave a Comment