Ödev
Çok boyutlu diziler kullanılarak "yıldızlar" ile ekrana "B" harfi yazan programı yazınız.
* * * *
* *
* *
* * * *
* *
* *
* * * *
public class Main {
public static void main(String[] args) {
String[][] letter = new String[6][4];
for (int i = 0; i < letter.length; i++) {
for (int j = 0; j < letter[i].length; j++) {
if (i == 0 || i == 2) {
letter[i][j] = " * ";
} else if (j == 0 || j == 3) {
letter[i][j] = " * ";
} else {
letter[i][j] = " ";
}
}
}
for (String[] row : letter){
for (String col : row){
System.out.print(col);
}
System.out.println();
}
}
}
Ödev
Submit your work to complete this lesson.
Join the project workspace to share your solution and receive feedback.
Lesson discussion
Swap insights and ask questions about Java101
Be the first to start the discussion
Ask a question or share your thoughts about this lesson.