I have two classes in separate files and I'm trying to import one class from the other. I was wondering how I could go about doing that? The the test class is supposed to take both methods from the first class and display them. I was wondering how I would go about doing that?
The first class:
public class StringUtils {
public static String padLeft(String orig, int n) {
orig = "testing for lab06";
return String.format("%1$-" + n + "orig", orig);
}
public static String padLeft(String orig, int n, char c) {
return String.format("%1$-" + n + c + "orig", orig);
}
}
The second (or test) class
public class StringUtilsTest {
public static void main(String args[]) {
System.out.println(padLeft);
System.out.println(padLeft);
}
}
StringUtils.padLeft(orig,n)andStringUtils.padLeft(orig,n,c)in StringUtilsTestorig,n, andcof the correct types inmain().