質問するログイン新規登録

回答編集履歴

3

アスキーコードの勘違い

2018/11/05 12:44

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -10,10 +10,10 @@
10
10
  package dir;
11
11
 
12
12
  public class ClassB {
13
- public static int a = 42;
13
+ public static int a = 97;
14
- static int b = 43;
14
+ static int b = 98;
15
- public int c = 44;
15
+ public int c = 99;
16
- int d = 45;
16
+ int d = 100;
17
17
 
18
18
  public ClassB() {
19
19
  }
@@ -55,6 +55,6 @@
55
55
  }
56
56
  ```
57
57
 
58
- [Wandbox](https://wandbox.org/permlink/ggox65IDTbiVQJ1a)
58
+ [Wandbox](https://wandbox.org/permlink/WgAGsUP7meN8Hsbc)
59
59
 
60
60
  コメントを一つでも外すとエラーが出ます。その理由について考えてみると良いでしょう。

2

追記

2018/11/05 12:44

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -1,6 +1,6 @@
1
1
  直交する概念です。
2
2
 
3
- - **public** クラスやメソッドへのアクセスが制限されないことを意味します。
3
+ - **public** クラスやメソッドへのアクセス範囲が制限されないことを意味します。
4
4
  - **static** クラスをインスタンス化しないでもアクセスできることを意味します。
5
5
 
6
6
  実験

1

修正

2018/11/05 12:42

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -14,6 +14,23 @@
14
14
  static int b = 43;
15
15
  public int c = 44;
16
16
  int d = 45;
17
+
18
+ public ClassB() {
19
+ }
20
+
21
+ ClassB(int dummy) {
22
+ System.out.println(ClassB.a);
23
+ System.out.println(this.a);
24
+
25
+ System.out.println(ClassB.b);
26
+ System.out.println(this.b);
27
+
28
+ //System.out.println(ClassB.c);
29
+ System.out.println(this.c);
30
+
31
+ //System.out.println(ClassB.d);
32
+ System.out.println(this.d);
33
+ }
17
34
  }
18
35
  ```
19
36
 
@@ -38,6 +55,6 @@
38
55
  }
39
56
  ```
40
57
 
41
- [Wandbox](https://wandbox.org/permlink/HXTjJyrKKK912MdS)
58
+ [Wandbox](https://wandbox.org/permlink/ggox65IDTbiVQJ1a)
42
59
 
43
- コメントを一つでも外すとエラーが出ますから、その理由考えてみてください。
60
+ コメントを一つでも外すとエラーが出ますその理由について考えてみると良でしょう