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

回答編集履歴

2

クラス名の修正

2018/07/08 06:05

投稿

yukapome789
yukapome789

スコア361

answer CHANGED
@@ -2,7 +2,7 @@
2
2
  で、呼び出し元で操作します。配列やコレクションで実現したいという強い意図があるようでしたら、添えずすみません。
3
3
 
4
4
  ```
5
- public class MathFunctionBean{
5
+ public class Math2xFunctionBean{
6
6
  private int x;
7
7
 
8
8
  public void setX(int x){

1

コードの修正

2018/07/08 06:05

投稿

yukapome789
yukapome789

スコア361

answer CHANGED
@@ -4,8 +4,16 @@
4
4
  ```
5
5
  public class MathFunctionBean{
6
6
  private int x;
7
+
8
+ public void setX(int x){
7
- private int y;
9
+ this.x = x;
8
-
10
+ }
9
- //セッターゲッターは省略
11
+ public int getX(){
12
+ return this.x;
13
+ }
14
+ public int getY(){
15
+ return 2*this.x;
16
+ }
17
+
10
18
  }
11
19
  ```