• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Forward reference

 
Sam Zheng
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reading through JLS, it seems that sometimes I can use some
sort of forward reference without causing compilation error.
One example from JSL is on page 21 of chapter 8. Relevant
part of the example is copied as below:
class UseBeforeDeclaration{
static{
x = 100; //ok
....
}
static int x;
}
However, I compile a simple example as the following and the
compiler is crying illegal forward reference:
class Test{
static{
x = 100;
}
static int x;
}
Can anyone help? What is going on here?
Thanks! Sam
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic