• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Forward reference

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could some explain to me what is "forward reference"?
Also, are panel and applet ocntainers that must be attached to a parent container??
Can you add a frame on top of another frame (Besides the internal frame)?
Thanks...
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've mostly seen this subject in relation to instance variables, where one variable would be declared and have the value of an uncreated second variable, resulting in a compiler error. e.g.
int myVar1 = myVar2; //This is the forward reference
int myVar2 = 10; //as myVar2 is undeclared
The simple solution is to rewrite these lines so that myVar2 is declared and assigned first:
int myVar2 = 10;
int myVar1 = myVar2;
There are ways to write code that does make forward references that fool the compiler, but that's another story. It's covered by Bill Venners in relation to object instance variable initialization at http://www.artima.com/designtechniques/initialization.html
HTH
Adam
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic