代码:
package com.keyoti.rapidSpell;
import java.util.Comparator;
// Referenced classes of package com.keyoti.rapidSpell:
// RapidSpellChecker
class RapidSpellChecker$CompareL
implements Comparator
{
public int compare(Object a, Object b)
{
return (int)(100D * (suggestionScore2b(topWord, (String)b) - suggestionScore2b(topWord, (String)a)));
}
public void with(String w)
{
topWord = w;
}
private String topWord;
RapidSpellChecker$CompareL()
{
}
}
Run Code Online (Sandbox Code Playgroud)
这是应用程序中的许多类.
什么是$符号class RapidSpellChecker$CompareL implements Comparator意味着什么?难道仅仅是在类名或具有一定的指导意义?
我怀疑这是反编译的代码.(见底部获取更多信息.)在$显示,这是一个嵌套类中RapidSpellChecker.所以代码原本看起来像这样:
public class RapidSpellChecker
{
// Other code withing RapidSpellChecker
static class CompareL implements Comparator
{
// Code for compare, with etc
}
}
Run Code Online (Sandbox Code Playgroud)
我已将其显示为静态嵌套类,因为您显示的代码没有任何对实例的隐式引用RapidSpellChecker.如果是这样,原始代码将是这样的:
public class RapidSpellChecker
{
// Other code withing RapidSpellChecker
class CompareL implements Comparator
{
// Code for compare, with etc
}
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,它是一个内部类.
编辑:我原本以为这是无效的代码; 你不能在Java中使用$中的标识符来开始.事实证明我错了.从Java语言规范,第3.8节:
$字符应仅用于机械生成的源代码,或者很少用于访问遗留系统上的预先存在的名称.
所以这是有效的,只是气馁.
| 归档时间: |
|
| 查看次数: |
156 次 |
| 最近记录: |