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

Any JLS specification for formal parameter

 
Ranch Hand
Posts: 2379
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers,
Any JLS specification regarding regaarding formal parameter declarartion rule....? like line 1 of this code will give compile time error.

------------------
azaman
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hello,
I dont think you can initialize variables in a method/constructor argument list since that place is kept for declaring the arguments which will be recieved when it is called. Anyhow, a = b will also not work since you are trying to set the variable a of the method; which does not exist. You would need to do: this.a = b;
Try this:

I hope what I am saying is right, someone please correct me if im wrong.
Thanks,
Kamil.
[This message has been edited by Kamil Dada (edited August 15, 2001).]
 
Ashik Uzzaman
Ranch Hand
Posts: 2379
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kamil both ur appraoch of telling this.a & a will work. int a is declared at line 1 and initialized by the constructor. So no problemo. Watch out line 2 & 3.....


------------------
azaman
 
reply
    Bookmark Topic Watch Topic
  • New Topic