Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Forward reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Forward reference" Watch "Forward reference" New topic

Forward reference

Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 273


Henry Wong

Joined: Sep 28, 2004
Posts: 18542

Michael Angstadt wrote:YES THIS MAKES TOTAL SENSE. GO SUN.

Yea. The compiler is not very good in this regard. It can be tricked easily by using a reference.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 273

It just seems like it would make more sense just to not allow a field to be used at all until it is declared. But who knows.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

The Java programming language was originally designed to be appealing to C++ programmers, and so it inherited large parts of its syntax and semantics from C++, where it probably works in a similar way.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Ninad Kulkarni
Ranch Hand

Joined: Aug 31, 2007
Posts: 787

Hi Michael,
You can find forward reference in JLS. See JLS

SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
It is sorta covered in the JavaRanch Style Guide.
subject: Forward reference
Similar Threads
question regarding initialzer.
Forward Referencing, Initializers
Instantiation/Forward referencing
Instantiation/Forward referencing
Ending a do while statement in this situation?