回答編集履歴
2
クラス名の修正
    
        answer	
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            で、呼び出し元で操作します。配列やコレクションで実現したいという強い意図があるようでしたら、添えずすみません。
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            ```
         
     | 
| 
       5 
     | 
    
         
            -
            public class  
     | 
| 
      
 5 
     | 
    
         
            +
            public class Math2xFunctionBean{
         
     | 
| 
       6 
6 
     | 
    
         
             
             private int x;
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
             public void setX(int x){
         
     | 
1
コードの修正
    
        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 
     | 
    
         
            -
              
     | 
| 
      
 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 
     | 
    
         
             
            ```
         
     |