I am developing one SDK in Android and all good. But I got stuck in a point, How can I hide the implementation from the user. For example, if I am exposing a method calcualteSum() to user shouldn't be able to see the operations happening in the background. Please refer the below code. This is currently I'm hiding the operation from the user. Is there any better way to do this?
public class MathCalulate {
//user will be able to access this method.
public int calculateSum(int a, int b){
return MyMath.sum(a,b);
}
}
Implementation class which will be hidden from the customer:
private class MyMath {
//user will not be able to access this method.
private int sum(int a, int b){
return a+b;
}
}