Your code's structure should look something like this:
public class Main
{
private void substitute2DArray()
{
// Implement your code here
}
public static void main(String[] args)
{
substitute2DArray();
}
}
That being said, your code still would not compile, but at least, you will see compilation errors that make sense now (such as str2D is an undefined variable).