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();
@@armagedon3505 i guess you already found your answer. still leaving this comment for others to find out. the count starts from 0. hence when the row number will be entered 4, it will count 5. cause 0,1,2,3,4. He wanted the exact number 4. That's why he choose i=1. if you choose i=0, the row number for 4 row will be 3.
I understood the previous videos quickly, so I thought I’d understand nested loops just as easily. Because of that I didn’t pay full attention to Bro’s explanation and ended up not understanding them, After about a week I watched the video again and listened carefully to Bro, and I understood it immediately. Thank you Bro
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
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
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
sorry for the late reply but next(); can only be used to input strings but not spaces, so if you want to input a word, you can use next(); nextLine(); can be used to input full lines and more than one word.It can read spaces as well. So, in the video, for example they used next(); to input the symbol as it is only on word(or character)
How does this work? I can only imagine rows and columns leave an empty space in relation to user input. Thereafter the symbol can take the shape left by the user input. However, how does tha machine know that after the first row that we dont only want the first row to have 5 symbols? But it continuously does that downwards? Btw when we enter our number for the condition of "print" does this make and count space horizontally while the "println" counts and makes space vertically?
print does not create a new line so thats why it goes horizontal. As per your other question, the machine knows this because of the system.out.println so the machine first puts in the amount of the symbol you want per line then it creates another row(line) and simply does it over and over again until loop is finished
Why we do no put a scanner.nextLine(); after rows = scanner.nextInt(); and columns = scanner.nextInt(); . Since scanner.nextInt() can only read integer and it won't escape the line, I am confused.
@@UltraSolarGod Scanner scanner = new Scanner(System.in); int rows; int columns; String symbol1 = ""; String symbol2 = ""; System.out.println("Enter # of rows: "); rows = scanner.nextInt(); System.out.println("Enter # of columns: "); columns = scanner.nextInt(); System.out.println("Enter first symbol to use: "); symbol1 = scanner.next(); System.out.println("Enter second symbol to use: "); symbol2 = scanner.next(); for(int i=1; i
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
Thanks for this am wishing for your channel to reach million soon
for(int i=1; i
@@armagedon3505 i guess you already found your answer. still leaving this comment for others to find out. the count starts from 0. hence when the row number will be entered 4, it will count 5. cause 0,1,2,3,4. He wanted the exact number 4. That's why he choose i=1. if you choose i=0, the row number for 4 row will be 3.
😊
I am having trouble understanding nested loops so I will watch this video on repeat until I understand.
practice makes perfect
Did u understand?
You have the gift of teaching.
One of the best sample codes I've seen for this series. That's some cool logic you used.
Dude, you teaching me better than my teacher could!!!
Thank you so much!
I understood the previous videos quickly, so I thought I’d understand nested loops just as easily. Because of that I didn’t pay full attention to Bro’s explanation and ended up not understanding them, After about a week I watched the video again and listened carefully to Bro, and I understood it immediately.
Thank you Bro
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
bro is god level teacher ,who made me understand same concept in 6:00 minutes which i'm struggling to learn for 2 years
This guy is really genius, java with this guy is like a piece of cake much love god bless bro
BOOM!!!! BEST UA-camR
Deserves the Gold Button
Bro you're a lifesaver, an actual one. Nice Tutorials
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
This guy is underrated asf!
I do follow and watch your tutorials. Perfect and simple explanation. Thank you Bro !!!
You’re doing the lords work bro
I bought udemy course and got bored now I am watching the same course from you thx bro
Best programing guides on youtube
This actually made sense! Thank you!!!
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
This video is very useful! Thank you for make this video bro😃😃😃
whats ythe difference between nextLine() and just next (). You have used both for strings?
sorry for the late reply but
next(); can only be used to input strings but not spaces, so if you want to input a word, you can use next();
nextLine(); can be used to input full lines and more than one word.It can read spaces as well.
So, in the video, for example they used next(); to input the symbol as it is only on word(or character)
@@FatimaAli-fr4bo thanks for the explanation!!
Publlic class Amazing video(){
}
question why this time you do not need to use println() to clear out the next int still bit confused about
quick question, how does it know to print the rows horizontally and the columns vertically?
because at the line
System.out.print(symbol);
is only a print statement, if you used
System.out.println(symbol);
it would print them vertically
Nested loops completely undestood. 14th. Thank you, ma Bro Sensei!
Why was the System.out.println(); in the for loop block so necessary that it's changing the whole output?
its makes colums go under
for general use is i the x-axis and j the y-axis would i be right as this would be the same as maths
My question is:
"Why the inner for loop variable "j" resets every "i" variable update but i keep growing till the condition is false (i
awesome explonation! thank you!
Bro has the best examples
awesome tutorials
Amazing video as always, Bro!
Well done !!!!
Great tutorial
Thx for the tutorial!
0:04 i find out that "nested loop work in java" u say is kinda like melody here XD
Good
This is tip and trick for programming language.
How does this work? I can only imagine rows and columns leave an empty space in relation to user input. Thereafter the symbol can take the shape left by the user input. However, how does tha machine know that after the first row that we dont only want the first row to have 5 symbols? But it continuously does that downwards?
Btw when we enter our number for the condition of "print" does this make and count space horizontally while the "println" counts and makes space vertically?
print does not create a new line so thats why it goes horizontal. As per your other question, the machine knows this because of the system.out.println so the machine first puts in the amount of the symbol you want per line then it creates another row(line) and simply does it over and over again until loop is finished
4:25
OMG! Where are the captions???
Nice
Hey bro, you are so wonderful.
bro ur the best
good bro
thanks for your help!!
Super video!
'columns cannot be resolved to a variable' how do i fix this?
Thank you man 💙💙💙💙
Why we do no put a scanner.nextLine(); after rows = scanner.nextInt(); and columns = scanner.nextInt(); . Since scanner.nextInt() can only read integer and it won't escape the line, I am confused.
Vazha
Hey I copied Everything but it doesn't work it only displays rows
Check the print / println
thx for explanation
how can i make it with boolean for example
Thanks, Bro! ☕
Hey bro code I have a question is this efficient?
Βρόχοι επανάληψης ενσωματωμένοι (nested), μέσα σε άλλους βρόχους επανάληψης.
thank you 😊😊😊
My code is being printed vertically
Same to do now ??
You the man
Thanks!
thx 4 vid bro !
thank you very much
Cool Bro, thanks :)
Nice.
👌
What should I do if I wanna 2 diff. symbols ,like " X & O " !!
Use one more Symbol scanner name.....( like : symbol2 )
@@Google_Engineer but how to print it can you give use the code ?? plz _/\_
@@UltraSolarGod Scanner scanner = new Scanner(System.in);
int rows;
int columns;
String symbol1 = "";
String symbol2 = "";
System.out.println("Enter # of rows: ");
rows = scanner.nextInt();
System.out.println("Enter # of columns: ");
columns = scanner.nextInt();
System.out.println("Enter first symbol to use: ");
symbol1 = scanner.next();
System.out.println("Enter second symbol to use: ");
symbol2 = scanner.next();
for(int i=1; i
thanks, bro!
thank you 😊
Thank you Bro
❤❤❤
Thanks, Bro 06/01/2024
Thanks brooo
thanks bro
loop-ception
Thanks
😍😍😍😍
thanks
❤
Merci
comment for algorithm!!
😃
Nested loops are so confusing 😭
that 's some good shit.
6 february
ty bro
😁😁
Yeah!
wild
yes, learnt
comment for stats
danke
God Bless you +12
14 thx
"Video 14"
BRO IS BRO
feed the baby bird
fellow human beings XD lol
Uhjj
17
oOoOoOoOo