What is difference between access modifier and access specifier in java

0 votes
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
2,359 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,200 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
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 3 days ago in Java by Sirajul
• 16,640 points
85 views
0 votes
1 answer

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

getParameter() - getParameter will return the value of ...READ MORE

answered Jun 29, 2018 in Java by Perry
• 17,010 points
446 views
0 votes
1 answer

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

Always TypeList is preferred over ArrayList. The ...READ MORE

answered Jul 9, 2018 in Java by Akrati
• 960 points
59 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
175 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 7,030 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,050 points
1,789 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,050 points
4,673 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,050 points
401 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,200 points
55 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,200 points
35 views