answersLogoWhite

0

Private in java

Updated: 8/16/2019
User Avatar

Wiki User

12y ago

Best Answer

The private identifier is used to specify that an element can not be directly accessed from the outside. For example, a field or method declared as private can not be accessed directly from outside of the object or class in which it is used.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Private in java
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why java is secured compare with other language?

Because there is an access specifier called private in java by which security can be provided


Are the private access specifiers in Java and C plus plus the same?

No.In Java, the private access modifier restricts member access to the class in which the member is declared. But in C++, private members are also accessible to friends of the class in which they are declared. The rough equivalent in Java would be package private access.Not that Java doesn't have access specifiers, it has access modifiers. When no modifier is specified, default access is implied, which is package private for classes and public for interfaces.


What is acess spacifier in java?

An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are: 1. Public 2. Protected 3. Default and 4. Private Private is the most restrictive access modifier whereas public is the least restrictive. Default is the access protection you get when you do not specifically mention an access modifier to be used for a java object.


What are the things not inherited from parent class in Java?

Private members are not inherited from the parent class.


Explain different access modifier in java?

An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are: 1. Public 2. Protected 3. Default and 4. Private Private is the most restrictive access modifier whereas public is the least restrictive. Default is the access protection you get when you do not specifically mention an access modifier to be used for a java object.


My runescape Private server DOS batch file won't open?

This may be because you have not either installed your java properly or you haven't set the PATH of your java properly or just simply your java is out of date and needs updating.


Discuss the different level of access protection in java?

An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are: 1. Public 2. Protected 3. Default and 4. Private Private is the most restrictive access modifier whereas public is the least restrictive. Default is the access protection you get when you do not specifically mention an access modifier to be used for a java object.


Does java class must have public method?

no you can have a class with no public methods and even with a a private constructor public class Example { //constructor private Example(){ } }


Two types of access modifier in java?

public, <blank/none specified>, protected, private


Write a Program to demonstrate accessibility of different access specifiers in java?

An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are: 1. Public 2. Protected 3. Default and 4. Private Private is the most restrictive access modifier whereas public is the least restrictive. Default is the access protection you get when you do not specifically mention an access modifier to be used for a java object.


When you go for private constructor in java?

When you do not want any other class to be able to instantiate your current class


Can you declared constructor as private?

If you declare the main method anything other than public, it will not run. If you declare main method as private, you would not be able to execute the class as a standalone java program. Any java class that needs to be executed as a standalone file needs to have a main method that is public, static and returns a void. Otherwise the Java compiler would not recognize the file as an executable standalone java file and would not allow you to run it.