about Lunar lander in Android (inner class)
I am very new to android.
Also very new to java, so please feel free to give me any advice, I would very appreciate it.
the question is in lunarlander.java
/** A handle to the thread that's actually running the animation. */
private LunarThread mLunarThread;
/** A handle to the View in which the game is running. */
private LunarView mLunarView;
bu开发者_JAVA百科t in lunarview.java
class LunarView extends SurfaceView implements SurfaceHolder.Callback {
/** Handle to the application context, used to e.g. fetch Drawables. */
private Context mContext;
/** Pointer to the text view to display "Paused.." etc. */
private TextView mStatusText;
class LunarThread extends Thread
I have only learned C and C++
so i can't figure it out why can I call a inner class??
Classes and fields without modifiers private or protected can be accessible from any class in the same package. We can access LunarThread
by LunarView.LunarThread
or import class LunarThread
as done in LunarLander.java:
import com.example.android.lunarlander.LunarView.LunarThread;
See any book about Java for references.
精彩评论