Method Returns the Same Value  

 

Method Returns the Same Value ï¿½Ë»ï¿½ï¿½ �׵��� �ҷ��� ������ ���� ���� ��ȯ�ϴ� �޼ҵ带 �˻��մϴ�.

���� Method returns the same value   üũ �ڽ��� ���õǰ� Inspection �� � ������ ���, Inspection �� ������� �׻� ���� ���� ��ȯ�ϴ� �޼ҵ带 �����ִ� Same return value  ï¿½ï¿½ï¿½ï¿½ ǥ���մϴ�.

�� �˻翡 ���� �߰ߵ� ������ ���� � ���� ������ �ַ�ǵ� �����ϴ�.


�� �˻�� � �ɼǵ� ������ �ʽ��ϴ�.


 

��� ��



���� �ڵ带 ���ʽÿ�:

 
public interface AnInterface {
    boolean methodA(int myInt);
}
 
public class AClass implements AnInterface {
    public boolean methodA(int myInt) {
        if(myInt > 0){
        return true;
    } else {
        return true;
    }
}
 
public void methodB() {
    if(methodA(1) == true){
        //some code here
        }
    }
}
 
public class AClassTwo implements AnInterface {
 
    public boolean methodA(int myInt) {
        //some code here
        return true;
    }
 
    boolean methodB(int i) {
        if (i > 0) {
            return true;
        } else {
            return false;
        }
    }
}

 

Inspection ï¿½ï¿½ �־��� �������̽��� Ŭ������ �����ϰ� �ִ� ������ ����ǰ� �� �Ŀ������� �� �����찡 ��Ÿ�� ���Դϴ�.



methodA �� �����Ǿ����ϴ���� �޼ҵ� ������ �� ��ȯ���� �׻� ���� ���Դϴ�.