My Code
class Spammer {
public static void main(String[] arguments) throws InterruptedException {
int infinite = 0;
while (infinite > 1) {
System.out.println("spamspamspamspamspamspamspamspamspamspam");
Thread.sleep(450);
}
}
}
public static void main(String[] arguments) throws InterruptedException {
int infinite = 0;
while (infinite > 1) {
System.out.println("spamspamspamspamspamspamspamspamspamspam");
Thread.sleep(450);
}
}
}
This will compile, but when I run it, there is no output whatsoever. Can anybody tell me what the problem is?
7
class Spammer
{
public static void main(String[] args) throws InterruptedException
{
while(true)
{
System.out.println(" ");
Thread.sleep(450);
}
}
}What Paril said, this should work fine.
Just use while(true)..
-P
-P
wait you coded java
is that a spambot? anyways, what ^ said.
It won't actually spam anything except his own computer. @op, From your code you either want it to output once or over and over. If you want it to output once, you need to add infinite++; after the println code, and if you want it over and over, check if infinite is equal to zero (== 0 ) or less than 1 ( 1 > infinite)
{
int infinite = 0;
while (infinite > 1) {
Switch the 0 and 1 around, then that should work, i believe....
int infinite = 0;
while (infinite > 1) {
Switch the 0 and 1 around, then that should work, i believe....
Because infinite is zero, so it will never be greater than 1
