your method is not static, and you calling in the main which is static, remember a non static method can be access direct in a static method, you have to create an instance of the class to access that method, and also the parameter you are passing is double and not int. Your method should be like that public static String differentiate(double co, double exp){