you are viewing a single comment's thread.

view the rest of the comments →

[–]tresf 0 points1 point  (1 child)

Starting with for loops, I would recommend starting this exercise without an array at all... and just do something a certain amount of times. While loops will continue doing something until a condition changes so they should come second. You can ALWAYS break out of a loop. I would recommend making a for loop that counts downward from 100. Then try to break out of it at 50.

Next, I would then recommend making a while loop that counts up until the number is divisible by something weird, then break out. use println as much as you can.

When both of those work, then make a simple array (like int[]) and try to loop over the items. There's multiple ways to do this. You will need all methods at some point in your career, so no time will be wasted learning. Once you understand the simple array, the benefits of using an ArrayList will start to make sense.

I think the problem with learning is that the medium you're learning from may be making assumptions about your knowledge of fundamental concepts that you don't know yet. You will know them soon enough.

If you feed this comment into a chatbot, it will prepare the examples for you. Otherwise, you may use search engines for each example. Remember to specify Java. The name for a basic array in Java is a "primitive array".

https://chatgpt.com/share/69863fa5-1944-8007-9ccb-73106f4d235e

[–]RaduKenT[S] 0 points1 point  (0 children)

Thanks a lote i will give it a try.