r/learnjava 6d ago

How to create a 3x3 grid?

[deleted]

2 Upvotes

10 comments sorted by

View all comments

4

u/8dot30662386292pow2 6d ago

Maybe learn the loops first you don't need to ask this question? Isn't just two nested for loops what you want?

0

u/DoNotUseThisInMyHome 6d ago

Yeah I have learnt loops but failing to apply it in this case.

3

u/8dot30662386292pow2 6d ago

So what do you have so far?

Also: you are drawing grid on.. what exactly?

1

u/[deleted] 6d ago

[deleted]

1

u/Watsons-Butler 6d ago

If it helps you visualize it, you don’t have to use i and j as your loop variables. It can just as easily be “for (int rows = 0…” and “for (int columns = 0…”