State the significance of public and private modifiers, JAVA Programming

Assignment Help:

State the significance of public, private, protected, default modifiers both singly and in combination and state the effect of package relationships on declared items qualified by these modifiers.

Public: Public class is visible in other packages, field is visible everywhere (class must be public too)

Private : Private variables or methods might be used only by an instance of the similar class that declares the variable or method, A private feature might only be accessed by the class that owns the feature.

Protected: Is available to all classes in the similar package and also available to all subclasses of the class that owns the protected feature. This access is given even to subclasses that reside in a dissimilar package from the class that owns the protected feature.

What you get by default i.e. without any access modifier (ie, public private or protected). It means that it is visible to all within an exact package.

 


Related Discussions:- State the significance of public and private modifiers

String, in java string is a

in java string is a

#title.swithcase, 2. Problem Description: A Java program needs to be writte...

2. Problem Description: A Java program needs to be written to display the result of following operations based input character. The table for input character with operations is : I

Define enumeration, Define enumeration? Enumeration is explained as val...

Define enumeration? Enumeration is explained as values type that having of a set of named values. These values are constants and are called enumerators. An enumeration type is

MATLAB, Requested figure handle in use by another object, how do i fix this...

Requested figure handle in use by another object, how do i fix this?

Streaming and decorator construction in java i/o, Java output and input is ...

Java output and input is described in terms of an abstract concept named a " stream ", which is a sequence of data. There are 2 types of streams. 1.      Byte streams (8 bit

Describe java operators, Describe java operators? An operator is a symb...

Describe java operators? An operator is a symbol which operates on one or more arguments to generate a result. The Hello World program is so easy it doesn't use any operators,

How to wrapping your own packages in java, How to Wrapping Your Own Package...

How to Wrapping Your Own Packages in java? Java does not limit you to using just the system supplied packages. You can write your own as well. You write packages just such as

What is a pointcut, A pointcut is something that describes at what joinpoin...

A pointcut is something that describes at what joinpoints an advice should be applied. Advices can be applied at any joinpoint that is supported by the AOP framework. These Pointcu

What is the use of textmessage, TextMessage having instance of java.lang.St...

TextMessage having instance of java.lang.String as its payload. Therefore it is very useful for exchanging textual data. It can also be used for exchanging difficult character data

What should be public and private, What should be public? What should be pr...

What should be public? What should be private? As a rule of thumb: Classes are public. Fields are private. Constructors are public. Getter and setter methods

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd