What is difference between access modifier and access specifier in java

+1 vote
This question was asked in my interview technical round. I am a little bit confused

can someone explain about this briefly in detail?

Thanks in advance
Feb 14 in Java by sathish kannan
6,001 views

4 answers to this question.

0 votes
Best answer

Access Specifier:- This can be understood as the access you provide to your code in Java whether other classes can access your code or not.

E.g. public, private, protected and default.

Access Modifier:- Java provides both Access Specifier and Access Modifiers for creating access to your Java code for other classes. Here modifier is also used to do the same task but there are limitations.

  1. Class Modifier:
    • abstract :- This defines the restriction such that objects cannot be created.
    • final:- This restricts a class from being inherited.
    • strictfp:- it is related to the checking of floating point values irrespective of OS.
  2. Variable Modifier:
    • static:no object creation required
    • final: cannot be reassigned
    • transient: it is not serialized
    • volatile: the values are liable for change

Hope you got the difference now.

answered Feb 14 by Priyaj
• 56,920 points
0 votes
Both are the same thing in Java. The only difference is that specifiers are liberal and modifiers are strict.
answered Feb 14 by Shashank
• 1,350 points
If both are same then why there are two concepts discussed separately?
They are similar concepts but not same.
0 votes
Java provides a default specifier which is used when no access modifier is present. Any class, field, method or constructor that has no declared access modifier is accessible only by classes in the same package. The default modifier is not used for fields and methods within an interface.
answered Feb 27 by Uk
0 votes
Access Specifier is used to provide your code in Java whether other classes can access your code or not.

Access Modifier provides both Access Specifier and Access Modifiers for creating access to your Java code for other classes. Here modifier is also used to do the same task but there are limitations.
answered Feb 27 by Pratosh kumar

Related Questions In Java

0 votes
2 answers

What is the difference between Set and List in java?

LIST SET Duplicates YES NO Order Ordered Depends on Implementation Positional Access YES NO List is an ordered sequence ...READ MORE

answered Aug 14 in Java by Sirajul
• 37,480 points
147 views
0 votes
2 answers

What is the difference between getAttribute() and getParameter() in java?

getParameter() returns http request parameters. Those passed from ...READ MORE

answered Aug 28 in Java by Sirajul
• 37,480 points
1,111 views
0 votes
2 answers

What is the difference between Type List and type ArrayList in Java

By List, you actually tell, that your object ...READ MORE

answered Aug 28 in Java by Sirajul
• 37,480 points
104 views
0 votes
1 answer

What is the difference between getPath(), getAbsolutePath() and getCanonicalPath() in Java?

getPath() - returns a String which denotes the ...READ MORE

answered Jul 25, 2018 in Java by Mrunal
• 680 points
280 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,380 points

edited Nov 6, 2018 by Omkar 10,234 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,110 points
2,288 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,110 points
5,949 views
0 votes
1 answer

Selenium JARS(Java) missing from downloadable link

Nothing to worry about here. In the ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,110 points
697 views
0 votes
1 answer

What is an Operand Stack in Java?

The basic utility of Operand Stack are ...READ MORE

answered Mar 7 in Java by Priyaj
• 56,920 points
104 views
0 votes
1 answer

How is inheritance in C++ different than that in Java?

The purpose of inheritance is same for ...READ MORE

answered Feb 6 in Java by Priyaj
• 56,920 points
52 views