aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Automatic Variables Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Automatic Variables" Watch "Automatic Variables" New topic
Author

Automatic Variables

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Which cannot be used in declaring and initializing an automatic (method call) variable?
A. Final
B. Public
C. Constants of non-primitive type
D. Inner class from other scopes
E. Initialized arrays(such as "{Hello", "Goodbye"})

which and why?
Thanks
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3219
Apparently only one:
public - No meaning in that context.
The others:
final - Legal. Can be handy esp. with local (inner) classes...
Constants of non-primitive type - Here is one legal: final String s = "ABC";
Inner class from other scopes - Here is a legal one: Outer.Inner oi = new Outer().new Inner();
Initialized arrays(such as "{Hello", "Goodbye"}) - Legal. Just like with any other array type.


I hope I understood the question correctly!


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thank you Tony
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3219
You are welcome... and I'd like to take the opportunity to thank Jim Yingst for his participation here. He is a Java programmer that knows his stuff (including the JLS!!) :-) And it's very nice of him to share his knowledge with everyone else here. That's what we pay him $100,000/yr for. Ha ha!
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18670
Ha! In Monopoly money, maybe. Anyway, glad to be here. I was looking at this forum anyway, and once I saw that you were making the move, and there are other knowledgable people like Paul and Frank fielding questions, I figured this was looking like a more interesting place to hang out. And thank you for taking on the moderator role. Things are looking good here. Cheers!

"I'm not back." - Bill Harding, Twister
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3219
Monopoly Money!? Good for you! Because I guess that means MICROSOFT STOCK!!! Ha ha!!!
No; I'm not anti Microsoft! I don't want to be persecuted by them! I'd rather have the GOVERNMENT on my back than MS!! (Yet Another MS Joke!)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Automatic Variables
 
Similar Threads
uploading file
Variables
user create folder at local
Why ,this code is not compiling?
can you figure this out?