Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-28-2008, 01:46 PM
Member
 
Join Date: Mar 2008
Posts: 2
N_i_X is on a distinguished road
[SOLVED] Why import isnt needed whn ref is used without storing to local variable
Hello, Guys
This is my first thread to the Forum....

Consider this statement

System.getProperties().getProperty("propertyname") ;

for this statement import of java.util.Properties is not required, but we are using method of Properties

but it will required for this statements.
Properties props = System.getProperties();
props.getProperty("propertyname");

Whats the reason??

Regards,
Nachiket
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-30-2008, 11:43 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,029
hardwired is on a distinguished road
Code:
System.getProperties().getProperty("propertyname") ;
The System class does import java.util.Properties so it can handle this internally and return the String.
If you want to declare a Properties type/object in your app then you must import java.util.Properties into your app to support the type.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 03-31-2008, 06:11 AM
Member
 
Join Date: Mar 2008
Posts: 2
N_i_X is on a distinguished road
Thank you,
Ohh, i just trying to find out in JLS and other books, just didnt got it...
Its a tricky one...

i am feeling like a dumb right now...

Anyways, Thanks.
Nachiket...
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] curiosity about String type variable monir6464 Advanced Java 1 04-08-2008 12:13 PM
storing and retrieving a file as such anil_manu Advanced Java 0 03-11-2008 02:27 PM
Storing data permanently shaungoater New To Java 2 03-10-2008 05:18 PM
is synchronization on method passing local variables as parameters needed reddzer Java Servlet 0 11-10-2007 05:47 PM
Storing Data Khorod New To Java 1 08-03-2007 06:48 AM


All times are GMT +3. The time now is 01:10 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org