How would I write a class that could enumerate all positive integers starting with 1?

Recommended Answers

All 3 Replies

Member Avatar for iamthwee

Try reading your notes.

and the notes from your math class to find out what a positive integer is.

Why do you need a class when you can do something like:

for(int i = 1; i <= Integer.MAX_VALUE; ++i)
{
    System.out.println(i);
}

Is this what you need or something else?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.