- 浏览: 18868 次
- 性别:
- 来自: 上海
最新评论
Java Modifiers 大体可以分为两类:
1) Access modifiers : public, protected, default, private
2) Non- Access modifiers : strictfp, final and abstract
Below are the modifiers for key word class:
1.public: The class can be used anywhere
2.abstract: The class is an abstract class and no instance of it can be generated
3.final: The class cannot be inherited
4.strictfp(strict floating point): Make the floating-point arithmetic in the class evaluated strictly. This ensures the interoperability of the floating-point calculation.
The following table shows what Access Modifiers are appropriate for classes, nested classes, member variables, and methods:
visible from anywhere | same as its class | same as its class | visible from anywhere | visible from anywhere |
N/A | its class and its subclass | its class and its subclass, and from its package | N/A | N/A |
only from its package | only from its package | only from its package | only from its package | N/A, default is public |
N/A | only from its class | only from its class | N/A | N/A |
If a class has public visibility, the class can be referenced by anywhere in the program. If a class has package visibility, the class can be referenced only in the package where the class is defined. If a class has private visibility, (it can happen only if the class is defined nested in an other class) the class can be accessed only in the outer class.
If a variable is defined in a public class and it has public visibility, the variable can be reference anywhere in the application through the class it is defined in. If a variable has package visibility, the variable can be referenced only in the same package through the class it is defined in. If a variable has private visibility, the variable can be accessed only in the class it is defined in.
If a method is defined in a public class and it has public visibility, the method can be called anywhere in the application through the class it is defined in. If a method has package visibility, the method can be called only in the same package through the class it is defined in. If a method has private visibility, the method can be called only in the class it is defined in.
发表评论
-
常用的Node.js的命令(npm ...)
2020-10-25 20:33 0## help npm <command> - ... -
软件设计中的一些术语
2015-10-19 16:46 837Generalization and Specializa ... -
Oracle 如何释放数据库空间
2014-07-16 22:23 1811当需要释放数据库空间的时候,通常的方案会用 ... -
常用Oracle查询语句(object, source, table, column, etc)
2014-07-10 14:09 1113a) How to know table Owner s ... -
如何在Eclipse中查看JDK类库的源代码
2012-05-21 13:11 694如何在Eclipse中查看JDK类库的源代码 设 ... -
Oracle Partition
2012-05-18 13:41 777最近有个Batch性能特别差,超过30个小时的运行,采用P ... -
如何创建Oracle Job
2012-05-18 13:23 789如何创建Oracle Job 方法1:执行如下脚本 ... -
Oracle Temporary table
2010-11-08 16:54 910Oracle临时表有两种类型: 一种建立sess ... -
Inner and Outer Join SQL statement
2010-11-02 13:13 941INNER JOIN: Retrieves customers ... -
Java Nested Classes
2010-11-02 10:23 774In Java you can define a class ... -
Java ClassLoader学习
2010-10-30 21:03 795什么是类加载器? 与普通程序不同的是,Java程序( ... -
LAMP架构初步认识
2010-05-09 22:35 1199LAMP(Linux-Apache-MySQL- PHP/ ... -
Java经典书籍推荐之中级篇 - J2EE
2010-04-29 14:14 0dd -
Java经典书籍推荐之中级篇 - J2ME
2010-04-26 13:36 1418掌握Java基础知识,入门后就有不同的方向了,比如J2M ... -
Java经典书籍推荐之入门篇
2010-04-22 08:55 1478对于Java程序员来说,要求技术进步,但可以选择的范围太广,可 ... -
Google AdSense基础知识
2009-12-23 21:51 836什么是 Google AdSense? Google AdSe ... -
揭开互联网中IP, PV, UV,PR神秘的面纱
2009-12-04 16:45 2563[同步援引 皇家庭院] ...
相关推荐
Java Class and Method Modifiers
### Java对象模型基础知识点 #### 一、Java对象模型概览 Java对象模型是Java编程语言的核心组成部分之一,它定义了如何在Java中创建、组织和管理类与对象。Java对象模型强调面向对象编程的基本原则:封装、继承、...
3. Modifiers:Java语言使用修饰符(modifiers)来指定数据、方法和类的属性和行为。 4. Statements:Java语言的语句(statements)代表一个动作或一系列动作,例如System.out.println("Welcome to Java!")。 Java...
--> JAVA IDENTIFIERS:- ... JAVA MODIFIERS:- 像其他语言一样,可以通过使用修饰符来修改类、方法等。 有两类修饰符: 访问修饰符:default、public、protected、private 非访问修饰符:final、abstract、strictfp
6. 访问修饰符(Access Modifiers): Java提供了`public`, `private`, `protected`和默认的访问修饰符,用来控制类的属性和方法的可见性。例如,`private`表示仅限类内部访问,`public`则允许任何地方访问。 7. ...
在本资源中,我们关注的是C、Java和Python这三种流行的编程语言的BNF范式。 首先,让我们详细探讨C语言的BNF范式。C语言的语法严谨且层次分明,它的BNF范式主要涵盖了程序的基本组成部分,如声明(declarations)、...
### Java中的类和对象总结 #### 一、类与对象的概念 在面向对象编程中,类(Class)和对象(Object)是两个核心概念。类是对象的抽象模板,它定义了对象的数据结构(即属性)和行为(即方法)。而对象则是类的具体...
7. **Access Modifiers** - **访问修饰符**: C#和Java都有类似的关键字来控制类成员的可见性,但具体关键字可能不同。 8. **Reflection** - **反射**: 两种语言都支持反射功能,用于在运行时获取类的信息和动态...
7. **访问修饰符** (access modifiers):如`public`、`private`、`protected`,控制类、变量和方法的可见性。 8. **接口** (interface):定义一组方法签名,但不包含实现,用于多态性。 9. **注释** (comments):...
10. **访问修饰符(Access Modifiers)**:如public、private、protected,控制类成员的访问权限。 11. **抽象类(Abstract Class)**:不能实例化的类,通常用于定义接口或提供部分实现。 12. **静态(Static)**...
- **访问修饰符 (Modifiers)**:如`public`,表示该类可以被任何其他类访问。 - **主方法 (Main Method)**:每个Java应用程序都有一个入口点,即`public static void main(String[] args)`方法。这是程序启动时调用...
书中还涵盖了接口(Interface)、抽象类(Abstract Class)、访问修饰符(Access Modifiers)、包(Package)等高级主题。此外,异常处理(Exception Handling)也是Java编程中不可或缺的一部分,它允许程序优雅地...
Java作为一门广泛使用的编程语言,拥有丰富的语法结构和关键字,其中修饰词(modifiers)是Java语言中的重要组成部分,用于限定类、方法、字段等的访问级别、生命周期以及特性。以下是对Java中11个修饰词的详细介绍...
修飾子(Modifiers) - **修飾子の種類**: - **アクセス修飾子**: `public`, `protected`, `private`, `default`(パッケージプライベート) - **非アクセス修飾子**: `static`, `final`, `abstract`, `...
面向对象编程是Java语言的核心特性,它是一种将现实世界中的实体抽象为类,然后通过类来创建和操作对象的编程范式。本节将深入探讨面向对象的程序设计,包括类和对象的概念,对象的创建和使用,以及信息的封装和隐藏...
16. **访问修饰符(Access Modifiers)**:如 `public`、`private`、`protected` 和默认修饰符,控制类、方法和变量的访问权限。 17. **静态(Static)**:修饰符,用于声明类级别的成员,而不是对象级别的。如 `...