C
Cork Soaker
I doubt that my subject makes sense.
So, I am a complete n00b to Java and so, I have a book...
In the book is the following program:
import java.io.*;
class FlatBroke
{
public static void main(String[] args)
{
for (int i=10; i=0; i--)
{
System.out.println("Pounds left: £" +i);
} //end actions depending on counter
System.out.println("Flat Broke!");
} //end method
} //end class definition
Now, it certainly seems simple, and correct, but I get the following
when trying to compile:
$ javac FlatBroke.java
FlatBroke.java:6: incompatible types
found : int
required: boolean
for (int i=10; i=0; i--)
^
1 error
As I see it, I'm even using an old book, or the wrong version of Java?
I'm using the OpenJDK 6 from the Ubuntu Hardy repositories. I wouldn't
have thought the versions would be this much different, so I'm clearly
missing something and I'm too dumb to see what.
I can't see why it would need to be a boolean, but then, I'm pretty
clueless as you have probably guessed.
I'm sure an expert can instantly see my problem. Can anyone help?
I looked at some pages from Google but they just confused me!
TIA
So, I am a complete n00b to Java and so, I have a book...
In the book is the following program:
import java.io.*;
class FlatBroke
{
public static void main(String[] args)
{
for (int i=10; i=0; i--)
{
System.out.println("Pounds left: £" +i);
} //end actions depending on counter
System.out.println("Flat Broke!");
} //end method
} //end class definition
Now, it certainly seems simple, and correct, but I get the following
when trying to compile:
$ javac FlatBroke.java
FlatBroke.java:6: incompatible types
found : int
required: boolean
for (int i=10; i=0; i--)
^
1 error
As I see it, I'm even using an old book, or the wrong version of Java?
I'm using the OpenJDK 6 from the Ubuntu Hardy repositories. I wouldn't
have thought the versions would be this much different, so I'm clearly
missing something and I'm too dumb to see what.
I can't see why it would need to be a boolean, but then, I'm pretty
clueless as you have probably guessed.
I'm sure an expert can instantly see my problem. Can anyone help?
I looked at some pages from Google but they just confused me!
TIA