Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
394 views
in Technique[技术] by (71.8m points)

java - Meaning of the Dollar symbol ($) in the log messages

    java.util.ConcurrentModificationException: null
    java.util.HashMap$HashIterator(HashMap.java:806)

    com.cimba.gsr.fragments.SessionsFragment(SessionsFragment.java:233)

    com.cimba.gsr.fragments.SessionsFragment$4(SessionsFragment.java:201)

Sometime in log output after a class name there is a Dollor symbol ($) in the message what does that mean? I thought it's the method name or the variable name in the class that caused the exception but in this case it doesn't make sense (SessionsFragment$4 it can't be the name of a method or variable). so what is it ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The $ is a separator that indicates that there is a nested class HashIterator inside the HashMap class, and that there is an anonymous inner class (the fourth one, it looks like) inside the SessionsFragment class.

This site explains the $ separator.

Filename: StackTrace.java

Line number: 267
Package name: boo.hoo
Full class name: boo.hoo.StackTrace$FirstNested$SecondNested
Simple class name: StackTrace$FirstNested$SecondNested
Unmunged class name: StackTrace.FirstNested.SecondNested
Direct class name: SecondNested
Method name: <init>
Native method?: false
toString():
boo.hoo.StackTrace$FirstNested$SecondNested.<init>(StackTrace.java:267)

The nested classes are distinguished from the higher-level nested classes and from the top-level class by using the dollar sign character ($). So, technically, the "simple" name of the second nested class is StackTrace$FirstNested$SecondNested.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...