GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 81 of 921    Print  
If a variable is declared as private, where may the variable be accessed
A private variable may only be accessed within the class in which it is declared.


  
Total Answers and Comments: 3 Last Update: January 15, 2008     Asked by: Ravi 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 20, 2007 13:13:20   #1  
kvsunilkumar Member Since: December 2007   Contribution: 40    

RE: If a variable is declared as private, where may the variable be accessed
only in  that particular function
 
Is this answer useful? Yes | No
January 06, 2008 13:59:51   #2  
Mithun Challa Member Since: January 2008   Contribution: 6    

RE: If a variable is declared as private, where may the variable be accessed
It may be accessed in any of the methods defined in that class. Generally for the security of the variables we declare them as private and using the public methods in the class we use them. Makinng sure that variables are accessible only in that class
 
Is this answer useful? Yes | No
January 15, 2008 04:29:30   #3  
craig.cattell Member Since: January 2008   Contribution: 2    

RE: If a variable is declared as private, where may the variable be accessed
A private variable can also be viewed from an inner class
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape