What access modifiers can be used for variables?



What access modifiers can be used for variables?..

Answer / Mohammad Ali Mehdi

In Java, there are four types of access modifiers that can be used for variables: private (accessible only within the same class), protected (accessible within the same package and subclasses in other packages), public (accessible from everywhere), and default or package-private (accessible within the same package)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is entry set in java?

1 Answers  


How long will it take to learn java?

1 Answers  


What modifiers can be used with a local inner class?

2 Answers  


When do we use synchronized methods in java?

1 Answers  


What is scanner in java?

1 Answers  


How many types of flags are there?

1 Answers  


What is Session reduplication and how its done?

1 Answers  


Which arithmetic operations can result in the throwing of an arithmeticexception?

1 Answers  


What is array length?

1 Answers  


What is a Wrapper class?

14 Answers  


What is the use of singleton?

1 Answers  


What is the flag in java?

1 Answers  


Categories