Hey people,

I'm at uni and we have lab sessions for Java.
In my lab session I have been given an exercise to complete however I need help because I don't know where to start!!

Can anyone help me? If you can I will post back with the task to see if you can make any sense of it.
By the way I am a beginner so the task wont be hard but I just need a point in the right direction.

Thanks
AdventureX

At the moment I have typed:

class RocketTest{


public static void main(String[] args){


Rocket varName = new Rocket();
varName.methodName();


newRocket.fuelRocket();

and I need to use a for loop to countdown from 10 to 0
would it be this:

for (int number=10; number<=0; number--) 

Thanks for posting back!

Edited 3 Years Ago by happygeek: fixed formatting

I know you are a beginner, but please post your code in code tags

Sorry about that I will do it from now on.

it will be this

for (int number=10; number >= 0; number--)

you must say, while number is greater than or equal to 0

i normally also try to avoid >= in for loops and use only >

for (int number=10; number > -1; number--)

also be aware this will execute 11 times, because it includes 0, but then again that may be what you are looking for

it will be this

for (int number=10; number >= 0; number--)

you must say, while number is greater than or equal to 0

i normally also try to avoid >= in for loops and use only >

for (int number=10; number > -1; number--)

also be aware this will execute 11 times, because it includes 0, but then again that may be what you are looking for

so rather than having 0 I should have 1, so it wouldnt count 11 times. I should have it like this?

for (int number=10; number >1; number--)

no, that is a negative -1

then it will count

for (int number=10; number > -1; number--)

10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0

if you don't want to include the 0 set

for (int number=10; number > 0; number--)

no, that is a negative -1

then it will count

for (int number=10; number > -1; number--)

10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0

if you don't want to include the 0 set

for (int number=10; number > 0; number--)

Fantastic, I know it was something simple but I appreciate you taking time out to help me. :)

Many Thanks
AdventureX

This question has already been answered. Start a new discussion instead.