I was a bit puzzled here too but I figured out what was confusing for me so maybe it could help some people understand. Just be aware that I am a very very beginner and that I just followed the tutorials he made before. In this video he presents two ways of making arrays in java but the final line of the code only use one of the two arrays he created All the stuff he wrote with the boolean array is not used in the println code at the end! Therefore you can remove all this part of the code : boolean[] student = new boolean[4]; student[0] = true; student[1] = false; student[2] = false; student[3] = true; and still have the same result at the end. It was just an exemple to explain that you can make boolean array in a different way but he did not used it to print something. I hope that it helped some people to understand. Please correct me if i'm wrong ;)
when i select run i get an error message. it says exception in thread "main" java.lang.run time exception : uncompilable source code - erroneous tree type : at tutorials.Main.main (Main.java:14) BUILD FAILED can you please explain it. thank you
Hello! You can make them all true. He simply wanted to make the values different so viewers might not think that they all have to be True or something. The order of the values doesn't really matter, but what does matter is that he is only using BOOLEAN values in the array. This is because the array data type is set to boolean.
It's his choice. He can do whatever he wants. Likewise, you can do anything you want in arrays. In fact, you can do whatever you want in Java itself. It's just the matter of how you code the program.
One thing though.. what's the purpose of him making that boolean [ ] when he doesn't even use it? Or is it being used and it's just me that haven't understand it yet?
And also, I have been struggling these last couple days in learning about boolean function. Sadly I cannot think of any use of it. Can anyone please tell me which video(s) explain it in a more basic way? I'm kinda new to java codes.
I was a bit puzzled here too but I figured out what was confusing for me so maybe it could help some people understand.
Just be aware that I am a very very beginner and that I just followed the tutorials he made before.
In this video he presents two ways of making arrays in java but the final line of the code only use one of the two arrays he created
All the stuff he wrote with the boolean array is not used in the println code at the end!
Therefore you can remove all this part of the code :
boolean[] student = new boolean[4];
student[0] = true;
student[1] = false;
student[2] = false;
student[3] = true;
and still have the same result at the end.
It was just an exemple to explain that you can make boolean array in a different way but he did not used it to print something.
I hope that it helped some people to understand.
Please correct me if i'm wrong ;)
You are incredible at explaining this and giving exact details. Very direct and told me exactly what I wanted to know. Thanks bro!! Def subscribed
Final code:
package tutorials;
public class Main {
public static void main(String[] args) {
int[] ages = { 17, 21, 18, 19 };
boolean[] student = new boolean[4];
student[0] = true;
student[1] = false;
student[2] = false;
student[3] = true;
for (int i = 0; i
Did u made a video on methods in java..? can't find it on your channel !!! guide please
Thank you for the clear explanation!
Why there is an error at the end? I don't catch it.
Hey, good job explaining arrays. Especially iteration of arrays and how we can get the out of bounds error.
How do you do that shortcut copying at 6:40?
TheJDM45
Ctrl + Shift + ↓
Thank you!
Code cannot compile..... incompatible type: int cannot be converted to int [ ]????
what to do
i seen my mistake... i didn't use square brackets inside of the ages for i [i]
Adolfo Espindola lol did the same thing it’s a habit I guess
should it not be boolean[] student = new boolean[3] since index numbers start at 0?
Dhwani 0, 1, 2, 3 = (4 different numbers)
when i select run i get an error message. it says exception in thread "main" java.lang.run time exception : uncompilable source code - erroneous tree type : at tutorials.Main.main (Main.java:14)
BUILD FAILED
can you please explain it. thank you
Only by looking at the error message cannot be helped. To fix it, we need the code you coded to find out the error
Can you traduce un french please for a soon video?
Why is the 9th video private?
It's public now.
I dont understand why did you make the boolean true, false, false, true? what's the difference if you make it all true? anyone
Hello! You can make them all true. He simply wanted to make the values different so viewers might not think that they all have to be True or something. The order of the values doesn't really matter, but what does matter is that he is only using BOOLEAN values in the array. This is because the array data type is set to boolean.
It's his choice. He can do whatever he wants. Likewise, you can do anything you want in arrays. In fact, you can do whatever you want in Java itself. It's just the matter of how you code the program.
I know that
One thing though.. what's the purpose of him making that boolean [ ] when he doesn't even use it? Or is it being used and it's just me that haven't understand it yet?
And also, I have been struggling these last couple days in learning about boolean function. Sadly I cannot think of any use of it. Can anyone please tell me which video(s) explain it in a more basic way? I'm kinda new to java codes.