I hav created a jar file named CustomValidations.jar which includes a single class file named CustomValidation.java
package validation; public class CustomValidation { public boolean matchFields(String str1,String str2){ if (!str1.equals(str2)) { return false; } else { return true; } } } I created another simple java project and I need to call the matchFields method
package com.codes; import CustomValidation.*; public class TestClass { public boolean CheckEmail(){ if(matchFields("sowmya","sowmya")){ System.out.println("Matched"); } else { System.out.println("Not Matched"); } } } It throws me an error saying "The import CustomValidation cannot be resolved" What is the correct way to call a method?
matchFieldsisn't static, you'll need an instance ofCustomValidationbefore you can use it...