• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Question on page 53: SCJP Sierra/Bates

 
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In SCJP 5 Study Guide by Kathy Sierra and Bert Bates.
On page 53, is the table in Figure 1-7 correct? Because on page 52 they bulletized how instance variables can and cannot be marked. This listing differs totally with the column marked "Variable (non-local) in Figure 1-7.

Or am I mistaken? (most likely scenario.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Smith,

All the bulleted lines in the list match with Figure 1-7.
1. use 4 access levels (public, private, protected, default)
2. marked final.
3. marked transient.
4. not abstract (only for class and methods).
5. not synchronized (only for methods).
6. not strictfp(only for class and methods).
7. not native(only for methods).
8. not static bcoz will become class variable(a bit confusing). But variable(non-local means outside method and inside class).
 
Higgledy Smith
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vejaykrishna,

I got confused because the titles from "instance variables" changed to "non-local variables."

Seems a static variable should be called a "package variable" instead of a "class variable." Because a static variable is visible to any class within the package.
 
Vejaykrishna Venkatesan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Smith,

you r right. "Class variables" will be called as "Package variable" but what i think is since it's given as non-local variable (i.e the variable not inside a method, class variables also gets included with instance variables).
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vejaykrishna R V:
.....
"Class variables" will be called as "Package variable"
.....[/QB]



To me the term "Package variable" would define a variable outside of any class but accessable to all of the classes in the same package.


Static(class) and instance variables and are subject to the same public, protected, defualt, private access restrictions as instance variables. I often define a "private final static" constant that are only visible to my class.
[ March 10, 2006: Message edited by: peter cooke ]
 
We're being followed by intergalactic spies! Quick! Take this tiny ad!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic