Java nested loops ➿

preview_player
Показать описание
Java nested loops tutorial explained

#Java #nested #loops
Рекомендации по теме
Комментарии
Автор

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

// nested loops = a loop inside of a loop

Scanner scanner = new Scanner(System.in);
int rows;
int columns;
String symbol = "";

System.out.println("Enter # of rows: ");
rows = scanner.nextInt();
System.out.println("Enter # of columns: ");
columns = scanner.nextInt();
System.out.println("Enter symbol to use: ");
symbol = scanner.next();

for(int i=1; i<=rows; i++) {
System.out.println();
for(int j=1; j<=columns;j++) {

}
}
}
}

BroCodez
Автор

I am having trouble understanding nested loops so I will watch this video on repeat until I understand.

orpyperson
Автор

One of the best sample codes I've seen for this series. That's some cool logic you used.

Curious_Clover
Автор

Great video. A clearer illustration of nested loops is a mechanical clock. The second hand ticks every second. The minute ticks every minute or every 60 ticks or 1 loop of the second hand. The same for the hour hand.

A little modification I would suggest is to put the println() to the end instead of the start of the inner loop.

for (int i = 1; i <= rows; i++) {
for (int j = 1; j <= cols; j++) {
System.out.print(symbol);
}
System.out.println(); // display the next row
}

python equivalent

for i in range (rows):
for j in range(cols):
print(symbol, end='')
print()

siusomeone
Автор

Dude, you teaching me better than my teacher could!!!
Thank you so much!

treezy
Автор

This guy is really genius, java with this guy is like a piece of cake much love god bless bro

balkhab
Автор

BOOM!!!! BEST YOUTUBER
Deserves the Gold Button

ctluwua
Автор

Bro you're a lifesaver, an actual one. Nice Tutorials

MrMorale
Автор

bro is god level teacher, who made me understand same concept in 6:00 minutes which i'm struggling to learn for 2 years

shivaramakrishnacheekati
Автор

I do follow and watch your tutorials. Perfect and simple explanation. Thank you Bro !!!

rafikismayilov
Автор

This actually made sense! Thank you!!!

JuliHoffman
Автор

This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro

pavelkvasnicka
Автор

Thank you so much. I don't really understand how the nested loop works, I want to fully understand how the program creates rows and columns. by the next time I see my comment, this should be different.

Thanks bro

zhyakoxalid
Автор

I bought udemy course and got bored now I am watching the same course from you thx bro

anlberkearslantas
Автор

Why was the System.out.println(); in the for loop block so necessary that it's changing the whole output?

mridulbhattacharjee
Автор

This video is very useful! Thank you for make this video bro😃😃😃

nutkimheng
Автор

whats ythe difference between nextLine() and just next (). You have used both for strings?

dunnodendedenish
Автор

quick question, how does it know to print the rows horizontally and the columns vertically?

cristiangarciaperez
Автор

Publlic class Amazing video(){



}

MueezAhmed
Автор

question why this time you do not need to use println() to clear out the next int still bit confused about

rylieRylie-ww