1

This code has stumped me.

ean521 1/2/14 1:21 pm
256
1/2/2014 3:39 pm
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);
}
}
}

This will compile, but when I run it, there is no output whatsoever. Can anybody tell me what the problem is?
Posted by
ean521
Level 11 : Journeyman Ranger
0

  Have something to say?

JoinSign in

7

Kaev
01/02/2014 3:39 pm
Level 8 : Apprentice Network
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.
1
Paril
01/02/2014 2:41 pm
He/Him • Level 89 : Elite Scapegoat Programmer
Just use while(true)..

-P
1
Starguy
01/02/2014 2:47 pm
Level 20 : Expert Ranger
wait you coded java
1
zagejk
01/02/2014 2:37 pm
Level 20 : Expert Network
is that a spambot? anyways, what ^ said.
1
bmanrules
01/02/2014 2:40 pm
Level 57 : Grandmaster Programmer
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)
1
ICDMCLP
01/02/2014 2:37 pm
Level 4 : Apprentice Miner
{
int infinite = 0;
while (infinite > 1) {

Switch the 0 and 1 around, then that should work, i believe....
1
bmanrules
01/02/2014 2:34 pm
Level 57 : Grandmaster Programmer
Because infinite is zero, so it will never be greater than 1
1

Welcome