1
  1. I saw so many sites, I get information like that.

    Access Specifiers:
    1.public,
    2.private,
    3.protected, and
    4.default.
    Access Modifiers:
    1.final,
    2.static,
    3.Synchronization,
    4.abstract and
    5.transient

  2. In other sites they told us both are same.

  3. In some other sites

    Access Modifiers will be:
    1.public,
    2.private,
    3.protected, and
    4.default.

I am totally confused about these things.
Can any one explain about this,please?

Cœur
  • 37,241
  • 25
  • 195
  • 267
HariKrishna
  • 101
  • 3
  • 13
  • http://way2java.com/oops-concepts/specifiers-modifiers/access-specifier-vs-access-modifier-in-java/ – Ruchira Gayan Ranaweera Sep 10 '14 at 09:57
  • yes but i saw in different site like http://www.javatpoint.com/access-modifiers .. so that i confused – HariKrishna Sep 10 '14 at 10:04
  • 2
    There are lots of pages around the internet claiming lots of things. Regarding Java, there is only one [authoritative source](http://docs.oracle.com/javase/specs/). See for example [class modifiers](http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.1.1), [field modifiers](http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.3.1) and [method modifiers](http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.4.3). Note how even Annotations are considered being modifiers… – Holger Sep 10 '14 at 10:16
  • javatpoint, roseindia etc., are not authoritative sources or normative references. Only the JLS is that. You can't cite any other source against what it says in the JLS. – user207421 Sep 10 '14 at 10:43

1 Answers1

0

The sites you have found are all spouting A grade drivel, and I have devoted non-trivial amounts of my life to extirpating them.

The term 'access specifier' does not appear in the Java Language Specification. That's all you really need to know. Random Internet sites, including Wikipedia and this one, can say whatever they like, but unless they agree with the JLS they are wrong.

Of the keywords you have mentioned, 1,2,3, and 4 are access modifiers, as they modify access to the item, and the rest are variously storage classes, Serialization keywords, synchronization keywords, or non-existent ('Synchronization').

user207421
  • 305,947
  • 44
  • 307
  • 483