boolean robotsAlive[];
int robotCount;


public int deadRobots (int robotCount, boolean robotsAlive[])
{
int deadRobots = 0;


boolean robotsALive = true;


for( int i = 1; i > robotCount; i++   )//a for loop to loop through the array
{
//inside the for loop
if( robotsALive[] == false ) //and if statment that says if robotsALive[]  == false
++deadRobots; //increment deadrobots by 1
}
//return the value of deadRobots outside the for loop
return deadRobots;


}//end of deadRobots method

When you get an error always post the complete message, including the line number where the error was found.
And post your code in CODE tags

The error is with the line
if( robotsALive[] == false )
it says error '.class' expected

That looks like an attempt to test if an array is false, which makes no sense because the array may contain some true and some false values.
Looking at the loop around that statement, I guess you meant to test just the one element of the array, as in
if( robotsALive == false )

ps that can be written more simply as
if ( !robotsALive )

I know that the code is not right I was just wondering what would make the commented psedocode work for this method?

public int deadRobots (int robotCount, boolean robotsAlive[])
{
int deadRobots = 0;

boolean robotsALive = true;

//a for loop to loop through the array
//inside the for loop
//and if statment that says if robotsALive[] == false
//increment deadrobots by 1
//return the value of deadRobots outside the for loop

}

Nothing. The pseudocode just has the same invalid concept of array==false
ps: I gave you the answer already in my previous post.

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.