Skip to content

Instantly share code, notes, and snippets.

@ron623
Last active April 4, 2016 09:18
Show Gist options
  • Save ron623/a266925735c4ec97c252 to your computer and use it in GitHub Desktop.
Save ron623/a266925735c4ec97c252 to your computer and use it in GitHub Desktop.
NestCls
package Nest;
public class NestCls {
// 非staticメンバ
int i = 0;
// staticなメンバ
static int a = 999;
// インナークラス(非static)
public class Inner {
// さらにインナーなクラス
class MoreInner{
// さらに、さらにインナーなクラス
class MoreMoreInner{
}
}
// 外側クラスのメンバを呼び出してみる
int test1 = i; // ふつーのめんば
int test2 = a; // staticなめんば
// staticなメンバ
// static int num = 1111; // ・・・・1
// インナークラスのメソッド
public void innerMtd() {
System.out.println("インナーです");
}
}
// staticな内部クラス
static class StaticCls {
// 外側クラスのメンバを呼び出してみる
// int test1 = i; // ふつーのめんば // ・・・・2
int test2 = a; // staticなめんば
// staticなメンバ
static int num = 1111; // ・・・・1
public void staticMtd() {
System.out.println("スタティックなんです");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment