• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

On Forward Reference

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am appearing for SCJP 2 1.4 Exam tomorrow. I do not have a good understanding on "Forward Reference on variables and methods".Can some one please explain me very brief.
Karthik
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the term 'forward reference' applies to using a method or variable before it has been declared. In c\c++, the compiler has to know the prototype of the method before it is used but Java is not so demanding.
The rules are:
Method Variables - you must declare and initialize a method variable before it is used
Class/Instance Variables/Methods - can be used in the source code file before they have been declared. The Java compiler will probably already know about these methods form a previous sweep through the file.
Good luck with your exam (if you haven't already taken it)
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic