Home> Java> javaTutorial> body text

How many non-access modifiers are there in Java?

WBOY
Release: 2023-08-30 18:01:08
forward
906 people have browsed it

How many non-access modifiers are there in Java?

Java provides some other modifiers to provide functionality beyond visibility. These modifiers are called non-access modifiers

  • staticMembers declared as static are common to all instances of the class. Static members are class-level members that are stored in class memory.
  • FinalThis modifier is used to restrict further modifications to a variable, method, or class. The value of a variable declared final cannot be modified once it obtains its value. Final methods cannot be overridden in subclasses, nor can you create subclasses of the Final class.
  • AbstractThis modifier can be used with a class or method. You cannot apply this modifier to variables and constructors. Methods declared abstract must be modified in subclasses. You cannot instantiate a class declared abstract.
  • SynchronizationThis modifier is used to control access to a specific method or block by multiple threads. Only one thread can enter a method or block declared as synchronized.
  • TransientThis modifier is used in the serialization process. Variables declared as transient are not serialized during object serialization.
  • VolatileThe volatile modifier is used in multi-threaded programming. If you declare a field as volatile, it signals to threads that its value must be read from main memory rather than from their own stack. Because volatile fields are common to all threads and will be updated frequently by multiple threads.
  • StrictfpThis modifier is used for floating point calculations. This keyword ensures that you get the same floating point representation on every platform. This modifier makes floating point variables more consistent across multiple platforms.

The above is the detailed content of How many non-access modifiers are there in Java?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!