Hi, the following messege appears when I compile this code.
ExtractChars(java.lang.String,int) in Question2 cannot be applied to ()
What should I fix?
Thanks.
import java.util.Scanner;
public class Question2
{
public static void main (String[] args)
{
ExtractChars();
}
public static String ExtractChars(String sOrg, int startPos)
{
Scanner scan = new Scanner (System.in);
String value = "";
System.out.print("Enter a string: ");
sOrg = scan.next();
System.out.print("/nEnter an integer: ");
startPos = scan.nextInt();
if (sOrg.length()<=startPos)
{
value = "";
}
else
{
for (int i=startPos; i<sOrg.length();i=i+2)
{
value = value + sOrg.charAt(i);
}
}
return value;
}
}