Java 中的重要关键词

原文:https://www.geeksforgeeks.org/important-keywords-java/

  1. 摘要:适用于类和方法的非访问修饰符。它用于实现抽象。更多信息,请参考 java 中的抽象关键字
  2. 枚举:用于在 Java 中定义枚举
  3. instanceof : 用于知道对象是否为指定类型(类或子类或接口)的实例。
  4. private : 是访问修饰符。任何声明为私有的东西都不能在它的类之外看到。
  5. protected : 如果您希望允许在当前包之外看到一个元素,但只允许看到直接子类化您的类的类,那么请声明该元素受保护。
  6. 公共:任何声明为公共的东西都可以从任何地方访问。

有关访问修饰符的更多信息,请参考 Java 中的访问修饰符

  1. Static: It is used to create a member (block, method, variable, nested class) that can be used by itself without referring to a specific instance. For more information, please refer to static keyword in java.
  2. Strict FP: It is used to limit floating-point calculations and ensure the same results on each platform when performing operations in floating-point variables. See more strict FP keyword in java.
  3. [T0】 synchronized: 【T1] Applicable to blocks and methods. It is used to get synchronization in java. Please refer to [Synchronized 【T3] in Java for more information.](https://www.geeksforgeeks.org/synchronized-in-java/)
  4. [t0 T0】 transient: transient is a variable modifier used in serialization . When serializing, if we don't want to save the value of a specific variable in the file, then we use the transient keyword. Refer to transient keyword in Java for more information.
  5. volatile : The volatile modifier tells the compiler that variables modified by volatile can be accidentally changed by other parts of your program. For more information, please refer to volatile keyword in java.

如果你喜欢极客博客并想投稿,你也可以写一篇文章并把你的文章邮寄到 contribute@geeksforgeeks.org。看到你的文章出现在极客博客主页上,帮助其他极客。

如果您发现任何不正确的地方,或者您想分享更多关于上面讨论的主题的信息,请写评论