do you have to declare each object in the array like you did with the class ob1 = new class; or is there an easier way to do it like how you can declare int arrays with a simple for loop?
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
bro ur an absolute g. I'm watching and following along with every video in ur java playlist and ur seriously filling in gaps. Im gonna use ur vids for the other languages as well. thanks bro
1:41 I don't understand why he is telling, "give a size if we do not plan assigning values right away". I m wondering arrarys are fixed if we declare size at the initialisation, meaning he have plan to assign 3 values at this program hence he is giving size 3. Is there a way he can increase the size dynamically during the run time if the array size is declared at the initialisation? Pls help to advise if I m missing something.
No, it didnt work, ive just tried it and I caught an error. I dont know why, buy it doenst work P.s this is my code if you want to look at: public class Main { public static void main(String[] args) { Food[] refrigerator = new Food[3]; Food food1 = new Food("pizza"); Food food2 = new Food("hamburger"); Food food3 = new Food("hotdog"); refrigerator [0] = food1; refrigerator [1] = food2; refrigerator [2] = food3; for (int i = 0; i
@@Golosovtalks You forgot to input the 'name' in the println statement, it shows the address of the food only if u not include name, hope this can helps for(int i=0; i
//******************************************************
public class Main {
public static void main(String[] args) {
//Food[] refrigerator = new Food[3];
Food food1 = new Food("pizza");
Food food2 = new Food("hamburger");
Food food3 = new Food("hotdog");
Food[] refrigerator = {food1,food2,food3};
//refrigerator[0] = food1;
//refrigerator[1] = food2;
//refrigerator[2] = food3;
System.out.println(refrigerator[0].name);
System.out.println(refrigerator[1].name);
System.out.println(refrigerator[2].name);
}
}
//******************************************************
public class Food {
String name;
Food(String name){
this.name = name;
}
}//******************************************************
do you have to declare each object in the array like you did with the class ob1 = new class; or is there an easier way to do it like how you can declare int arrays with a simple for loop?
@@nikleduc1158 You can also do for loops :D
The laziest person who copy this text files :)
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 god I can finally organize my fridge.
You are amazing. Your knowledge and delivering skill is amazing
best videos about programming
Insane this is 3 years old but has done the best job at explaining how to get this done. Bravo!
Well done explained.
Bro is coming in clutch for my cs final tomorrow -- Thank you!
bro ur an absolute g. I'm watching and following along with every video in ur java playlist and ur seriously filling in gaps. Im gonna use ur vids for the other languages as well. thanks bro
thanks brother we appreciate your efforts ....best of luck
Completely understood, also with for loop for int numbers this time. 31th. Thank you, ma Bro Sensei!
Wow man, thank you for making this! It really helped
Great
tyanks for your help
Straight to the point nice video♥️
thanx for the help!
thanks for this great tutorial series
Thanks bro
Great video bro
Thanks, Bro!
nice
i just punched the like button because of One Punch Man.
Good video as always
I loved it
Thanks🎉🎉🎉😊
Bro code the best
noice
lets gooooo
Great video
Thanks
best brooo
Nice.
thanks
Is this array bag?
gg
Thanks!!
thank you bro
Thank you Bro
how do automatically create an object? what if you allow the user to add a food? how to auto create food4
i like food
Another banger lesson
Perfect!
thank sir
Can I create an arrayList of objects?
Like and comments
West Jett
Thank you
Being formal, isn’t an array of objects technically called an ArrayList?
1:41 I don't understand why he is telling, "give a size if we do not plan assigning values right away". I m wondering arrarys are fixed if we declare size at the initialisation, meaning he have plan to assign 3 values at this program hence he is giving size 3. Is there a way he can increase the size dynamically during the run time if the array size is declared at the initialisation? Pls help to advise if I m missing something.
Using arraylists, you can change the size during runtime
But how do I enter new value inside the array object
Thanks, Bro 06/08/2024
I need this @ Number 9
thanks. but unable to understand
Where do you study Bro ?
thanks for the pizza
comment for stats. thanks bro!
sup
All ppl in the comments, I understood, Thanks, simple
Me:Fk me 😢
xd
vedio 31
need new videos!
day 25 of coding
comment
You can print all three elements using for loop
for(int i = 0; i < 3; i++) {
System.out.println(refrigerator[i].name);
No, it didnt work, ive just tried it and I caught an error. I dont know why, buy it doenst work
P.s this is my code if you want to look at:
public class Main {
public static void main(String[] args) {
Food[] refrigerator = new Food[3];
Food food1 = new Food("pizza");
Food food2 = new Food("hamburger");
Food food3 = new Food("hotdog");
refrigerator [0] = food1;
refrigerator [1] = food2;
refrigerator [2] = food3;
for (int i = 0; i
@@Golosovtalks You forgot to input the 'name' in the println statement, it shows the address of the food only if u not include name, hope this can helps
for(int i=0; i
You can also do that with
for (Food i: refrigerator) {
System.out.println(i.name);
}
thanks
thanks bro
Short, Simple & Effective. Thanks a ton.
Like a mini skirt
if you have to create 30+ objects can you use a for loop to instantiate them?
Sure, something like this might work
Car[] cars = new Car[30];
for(int i = 0; i < 30; i++) {
cars[i] = new Car();
}
These videos are very useful for us beginners. Thank you!
thanks
Thank you so much, I could understand only watching once. Very good example
great video!!! I'm infinitely grateful for your dedication and big heart to share this knowledge with the world. Thank you soo much
System.out.println("Thank you bro");
name is in the Food class object. So how it is associating with main class when you are printing the food name.
Can you explain it please?
Lets get this bread
sometimes it seems that you work as an ambassador of pizza companies. But I doesn't matter, as usual thanks
Is pizza your favorite food, cause you mention about it everytime
Java seems easier than python
Thank you! This helped me out.
learnt
Thanks, bro.
Thank you dude! Now I can write my homework and know more about classes and objects!
I am a heroooo
nice 1
Good goody!
comment
Thanks!
Nice
comment
❤❤❤
🙃
💙
🍱👍
.
Excelent video, very helpfull to newbies like me!
🙏🏻
You are stingy to give, I know you know there is something simpler than that.