File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Why not legal java ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Why not legal java ?" Watch "Why not legal java ?" New topic

Why not legal java ?

Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580

Joe Ess

Joined: Oct 29, 2001
Posts: 9189

Identifiers are only valid within the scope they are declared. You declared i within the synchronized block, it is not accessible outside of the block. There's a detailed explanation of scope in the Java Tutorial

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: Why not legal java ?
It's not a secret anymore!