Using your Ex2 as a base for it, notice how for(int x = 0;
x < y; x++) will never be true the first time around, as both x and y would equal 0. This is the cause for you needing to add that extra star after the loop.
A better approach would be to set the outer loop to begin at 1 and test for EQUAL TO and LESS THAN.
As you've already got Ex2 done, i'll give you a rework of it so that you can understand and better solve this next step.
Code java:
public static void main(String args[]) {
final int MAX_ROW = 5;
final String ARROW = "->";
for (int row = 1; row <= MAX_ROW; row++) {
for (int col = 0; col < row; col++) {
System.out.print("*");
}
System.out.println("");
}
}
Ofcourse the fix will be the same in both templates, I just hope you can try understand your problem better when values etc are clearer.