• 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

Automatic variables

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
class proto
{
static public void main(String proto[])
{
int i;
System.out.println("Javix Protocol");
}
}

Why is this code compiling?
Aren't automatic variables compulsorily initialized?
Anygood soul mend tp provide info??
------------------
The Javix
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
The code will not compile if you try to call the local (Automatic) variable which is initialised.
Replace the code as indicated below
System.out.println("Javix Protocol",i);
 
surya sadhu
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Please ignore the previous reply.
The code will not compile only if you try to call the local (Automatic) variable which is not initialised.
Replace the code as indicated below
System.out.println("Javix Protocol",i);
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more correction
System,out.println("Javix protocol"+i);
 
Javix Protocol
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr Mani
System(,)out.println("Javix protocol"+i);
(,) should be . i think ..
------------------
The Javix
 
reply
    Bookmark Topic Watch Topic
  • New Topic