Reputation: 2313
This code does not compile.
public class Diamond {
public static void diamondOfAsterisks(String * ) {
for (int i = 1; i < 10; i += 2) {
for (int j = 0; j < 9 - i / 2; j++)
System.out.print(" ");
for (int j = 0; j < i; j++)
System.out.print("*");
System.out.print("\n");
}
for (int i = 7; i > 0; i -= 2) {
for (int j = 0; j < 9 - i / 2; j++)
System.out.print(" ");
for (int j = 0; j < i; j++)
System.out.print("*");
System.out.print("\n");
}
}
}
Thanks
Upvotes: 0
Views: 142
Reputation: 38195
Just remove the "arguments" of your method:
public static void diamondOfAsterisks() {
....
Upvotes: 2
Reputation: 89169
The answer is this won't compile...
public static void diamondOfAsterisks(String * ) {
C++ Pointers convention don't apply in java...
Upvotes: 0
Reputation: 62593
public static void diamondOfAsterisks(String * )
That won't compile! Use a valid identifier such as star
or asterisk
Upvotes: 0