Question
What is the importance of public, private, protected, default modifiers both singly and in combination and explain how declared items qualified by these modifiers are effected by the package relationships ?

Answers

Public : Field is visible everywhere whereas Public class is visible in other packages (class must be public too) Private : Private variables or methods may be used only by an instance of the same class that declares the variable or method, A private feature may only be accessed by the class that owns the feature.
Protected : Is available to all classes and sub classes in the same package of the class that owns the protected feature.This access is provided even to subclasses that reside in a different package from the class that owns the protected feature.
Default :It is visible to all within a particular package. without any access modifier (ie, public private or protected)   Your Comment




More Software,Java Questions..
What is the inputsplit in map reduce software?

Can variables be used in Java without initialization?

What is the difference between java bean and enterprise java bean?

What is software configuration management?

How does the java database connectivity (jdbc) work?

What are the advantages of threads in java?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

What is object cloning in Java?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?



Search
Can you Answer!!
  • Q What is vmware fault tolerance?
  • Q What happens to the TSH (thyroid-stimulating hormone) blood level in hypothyroidism? Why is there enlargement of the thyroid in the endemic goiter disease?
  • Q Who was the leader to have the unique distinction of firing the first shot in the rebellion of 1857?
  • Q what is the Acronym for EBCDIC
  • Q Who was the first man on the moon?
  • Q Other useful programs for SAPScript
  • Q Which popular figure that tragically passed away recently founded the "Hawala Party" and got it registered with the Election Commission. His latest project is titled. Power Cut?
  • Q What animal has a prehensile penis
  • Q what is the scientific name of Chipmunk ?
  • Q what is the difference between website and portal
  • Q What does it mean to declare a destructor as static?