Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

My question is about variable

Atul SharmaAtul Sharma Member Posts: 1

I am new to java and learning about for and while Loops But I was trying to do something in below Code.

for(int z = 32; z <= 43; z = z + 1) {
System.out.println( " Value of z is " + z);

}


while(z <= 46 )
 {
     System.out.println(" The number z will increase from here" + z );
 z++;


 }

I want java to take the value of Z as 43 when while condition runs and print the other message
But it is giving the following error
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
z cannot be resolved to a variable
z cannot be resolved to a variable
z cannot be resolved to a variable

Answers

Sign In or Register to comment.