Java: Keywords Combination Summary

本文总结了Java中关键字的使用情况,包括private、protected、public等,并详细解释了这些关键字在类声明、成员变量及方法中的应用规则。对于理解Java语言特性和编写规范化的代码具有指导意义。

Hi guys,

Following is a summary about the combination of Java keywords.

Hope it will be useful for all Java guys.

For any question, please contact yexianyi@hotmail.com

Thanks,

Xianyi.Ye

Java Keywords Combination Summary

private

protected

public

abstract

static

final

synchronized

native

General

Class

Declaration

Same as the declaration of interface and abstract class

Only Inner class could be declared as static

Synchronized and native only could be used for method declaration

General

Class

Member Variables

Synchronized and native only could be used for method declaration

General

Class

Member Method

Interface

Declaration

Same as General class declaration, interface only could be declared as public and abstract

Since the purpose of declaring interface is to make derived class inherit it, so it is not allowed to set interface as final.

Interface

Member Variables

 

(d)

 

(d)

(d)

Default type of interface variable is public, static and final.

Interface

Method

 

(d)

(d)

Default type of interface method is public and abstract.

Abstract Class

Declaration

Same as General class declaration, abstract class only could be declared as public and abstract

Since the purpose of declaring abstract class is to make derived class inherit it, so it is not allowed to set abstract class as final.

Abstract Class

Member Variables

 

Synchronized and native only could be used for method declaration

Abstract Class

Method

Inner Class

Declaration

Synchronized and native only could be used for method declaration

Inner Class

Member Variables

 

(If class is static )

Synchronized and native only could be used for method declaration

Inner Class

Method

(If class is static )

Anonymous Inner Class

Member Variables

Since the declaration and definition of Anonymous Inner Class is bound together, so we cannot set the keyword static on both declaration and

Member variables

Synchronized and native only could be used for method declaration

Anonymous Inner Class

Method

Since the declaration and definition of Anonymous Inner Class is bound together, so we cannot declare method as abstract as well as static.

转载于:https://www.cnblogs.com/duadu/archive/2010/06/27/6335581.html

Error: org.apache.hadoop.mapreduce.counters.LimitExceededException: Too many counters: 121 max=120 at org.apache.hadoop.mapreduce.counters.Limits.checkCounters(Limits.java:101) at org.apache.hadoop.mapreduce.counters.Limits.incrCounters(Limits.java:108) at org.apache.hadoop.mapreduce.counters.AbstractCounterGroup.addCounter(AbstractCounterGroup.java:78) at org.apache.hadoop.mapreduce.counters.AbstractCounterGroup.addCounterImpl(AbstractCounterGroup.java:95) at org.apache.hadoop.mapreduce.counters.AbstractCounterGroup.findCounterImpl(AbstractCounterGroup.java:123) at org.apache.hadoop.mapreduce.counters.AbstractCounterGroup.findCounter(AbstractCounterGroup.java:113) at org.apache.hadoop.mapreduce.counters.AbstractCounterGroup.findCounter(AbstractCounterGroup.java:130) at org.apache.hadoop.mapred.Counters$Group.findCounter(Counters.java:369) at org.apache.hadoop.mapred.Counters$Group.getCounterForName(Counters.java:314) at org.apache.hadoop.mapred.Counters.findCounter(Counters.java:479) at org.apache.hadoop.mapred.Task$TaskReporter.getCounter(Task.java:689) at org.apache.hadoop.mapred.Task$TaskReporter.getCounter(Task.java:633) at org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl.getCounter(TaskAttemptContextImpl.java:76) at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.getCounter(WrappedMapper.java:101) at com.sina.ud.map.keyword.GameKeywordsMapMapper.map(GameKeywordsMapMapper.java:124) at com.sina.ud.map.keyword.GameKeywordsMapMapper.map(GameKeywordsMapMapper.java:27) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:146) at com.sina.hadoop.DelegatingMapper.run(DelegatingMapper.java:34) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:243) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1750) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:237) 这段mr报错原因是啥
最新发布
07-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值