+ 4
Why is my timestop programm illegal?
I wanted to build a method that can stop the program for a few seconds, so the user can have breaks between the output that he receives. What is my mistake here? Is it actually possible? public void stopSeconds(long s){ long a = System.getCurrentTimeMillis(); do{ long z = System.getCurrentTimeMillis(); long dif = z-a; long stop= s*1000; }while (dif <= stop); https://code.sololearn.com/cxA03SBLV7sn/?ref=app
6 Respuestas
+ 4
You cannot use functions inside a function. You can either place the method outside the main or convert it to a lambda expression.
+ 2
It's better to use the sleep method
+ 1
Allrigghhht :D Thats interesting!! yeah thanks, i think ill study the new commands then :D
+ 1
Interesting fact this feature of having a method inside another is coming to C# but with some limitations.
0
Bennett Post So i have to include methods always in other classes?
0
I seeeee thanks Bennett Post 😁😁😘