thx bro. I'm wanting code with a "pretend" calendar, so user can jump ahead in time. this video got me started. lately, every java search I make in youtube ends with bro code :)
I tried to start the timer countdown on a certain input with an if statement. Idk if it didn't like how I was using scanner input, or if the timer stuff doesn't like being in an if statement, but I have yet to make it work how I want it. I'll keep learning, but any help is appreciated. It's not important, just me trying to get ahead of myself, but I like to know how things work. Thanks for the great tutorials!!!
I took a sneak peak at the explorer section to the left of your screen, I'm quite intrigued by the map project. It would be cool to do something with Google maps API. 🤩
You literally just subed to my channel with 0 Subs and 0 Videos. Do I know you? XD I dont think i ever stumbled across one of your Videos. Why do you know me and where did you find me? XD
@@BroCodez Well, time to change your password. XD I didn't watch these kind of videos. I dont even Programm in java. I just do a little Visual Basic and Mcfunctions. XD
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;
public class Main {
public static void main(String[] args) {
// Timer = A facility for threads to schedule tasks
// for future execution in a background thread
// TimerTask = A task that can be scheduled for one-time
// or repeated execution by a Timer
Timer timer = new Timer();
TimerTask task = new TimerTask() {
int counter = 10;
@Override
public void run() {
if(counter>0) {
System.out.println(counter+" seconds");
counter--;
}
else {
System.out.println("HAPPY NEW YEAR!");
timer.cancel();
}
}
};
Calendar date = Calendar.getInstance();
date.set(Calendar.YEAR,2020);
date.set(Calendar.MONTH,Calendar.DECEMBER);
date.set(Calendar.DAY_OF_MONTH,31);
date.set(Calendar.HOUR_OF_DAY,23);
date.set(Calendar.MINUTE,59);
date.set(Calendar.SECOND,50);
date.set(Calendar.MILLISECOND,0);
//timer.schedule(task, 0);
//timer.schedule(task, date.getTime());
//timer.scheduleAtFixedRate(task, 0, 1000);
timer.scheduleAtFixedRate(task, date.getTime(), 1000);
}
}
Thanks
Practicing...
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;
public class Main{
public static void main(String[]args){
Timer timer = new Timer();
TimerTask task= new TimerTask(){
int counter = 10;
@Override
public void run(){
if(counter>0) {
System.out.println(counter+" seconds");
counter --;
}
else{
System.out.println("Interview with Priscilla");
timer.cancel();
}
}
};
Calendar date = Calendar.getInstance();
date.set(Calendar.YEAR,2023);
date.set(Calendar.MONTH, Calendar.FEBRUARY);
date.set(Calendar.DAY_OF_MONTH,19);
date.set(Calendar.HOUR_OF_DAY,8);
date.set(Calendar.MINUTE, 59);
date.set(Calendar.SECOND,20);
date.set(Calendar.MILLISECOND,0);
//timer.schedule(task,0);
//timer.schedule(task, date.getTime());
//timer.scheduleAtFixedRate(task, 0, 1000);
timer.scheduleAtFixedRate(task, date.getTime(), 1000);
}
}
The language is beautiful, your voice is clear and your teaching is fantastic keep it up bro
You are seriously amazing dude your tutorials alone have taught me Java
Your tutorial is amazing! The best!
Loving the java tutos 👍
my man u are a true legend
Well Im a Fellow Bro 🤜🤛
You make the best java tutorials.
Bestt tutor with humour. Thanks alot!
Liked
Commented
Subscribed
the king of tutors
Bro, terrific series. Thx!
the greatest outro ever!
perfect examples thanks a lot
Really nice video.
I didn't see any documentation on Timer and I found your video
Really helped me understand everything.
Im brazilian programer and you helped me a lot, thanks bro
Thanks an unimaginable amount, bro.
Best Java tutorial out there, thanks a lot Bro!
This helped me a lot :) Thank you
tysm! I was looking for a way to run code every 10 milliseconds while something else is running and this helped me a lot.
Suporting to keep the channel running
thanks . congratulations on 100k subscriber !
Very few Americans nowdays do Java because it's so hard, so thank you.
Lol
Sir I love your videos.
This is fun..like it👍
nICE
Love it
thx bro. I'm wanting code with a "pretend" calendar, so user can jump ahead in time. this video got me started. lately, every java search I make in youtube ends with bro code :)
Thank you! This solution was surprisingly hard to find on Google/TH-cam
Nice video thank you.
very helpful thank u
I tried to start the timer countdown on a certain input with an if statement. Idk if it didn't like how I was using scanner input, or if the timer stuff doesn't like being in an if statement, but I have yet to make it work how I want it. I'll keep learning, but any help is appreciated. It's not important, just me trying to get ahead of myself, but I like to know how things work. Thanks for the great tutorials!!!
thank you bro very helpfull
thanks bro
My Chinese teacher created a little game calls plane fight, and in the game he used timer task. To control enemy’s little plane’s speed.
Nice
can you make videos on python projects? if you do, can you add one that has to do with object-oriented programming?
I'll be switching back to Python soon. I wanted to add some more Java videos first due to popular demand
Bro Code ok thx
Bro Code I don’t understand his second part of his question. What does he mean by can you add one that has to do with OOP?
@girl中国 a Python project that uses Object-Oriented Programming
@@BroCodez no no no , no python, stay in Java LOL
Super
85th. Thank you, ma Bro Sensei
Thank you so much!
Nice work
Thanks
❤
Thank you very much 💕;)
helpful ! thanks
nice video man
thank you bro .
I took a sneak peak at the explorer section to the left of your screen, I'm quite intrigued by the map project. It would be cool to do something with Google maps API. 🤩
That's a Dungeons & Dragons map generator for a hobby of mine, but a Google Maps program would be a fun project
@@BroCodez I like the fact that you do programming as a hobby, and this would explain why your tutorials are so great. Thank you for them btw.
which software are u using ??
Eclipse IDE, I'm using dark theme
Hi!
does this functions works as coolDown in games? (for skills, events...)
Thanks bro !!
Ly bro 11
Frrr thx
Brooooooooo
dude i saw you subscribed to me.
crazy thing is i have a java exam on tuesday! im really bad at it but i hope i make it.
good luck dude
Happy New Year !
thanks cutie
what music did you use at the beginning of the video and in the intro?
darude sandstorm
@@BillboMC its been a year and idk why i made this comment hahaha
aaaannnd THANK YOUUUUU
great video but I guess useless for my specific project ;P
haha well you'll know for future projects
thanks!
U deserve more views :(
How will I make it to execute every day by midnight
hey this timer Task I used to update data in database....that through null point exception......you have any soluntion share me please.
10
My birthday is 20th of june
Support
hi
4
1
3
5
8
6
2
9
lol
You literally just subed to my channel with 0 Subs and 0 Videos. Do I know you? XD
I dont think i ever stumbled across one of your Videos.
Why do you know me and where did you find me? XD
I have no idea. Probably from one of a few Learn Java in X minutes videos
@@BroCodez Well, time to change your password. XD I didn't watch these kind of videos. I dont even Programm in java. I just do a little Visual Basic and Mcfunctions. XD
This has been deprecated :)
7