java.util.Properties--quick question

N

Nishi Bhonsle

Hi:

I needed to know whether the getProperty(..) method in java.util.Properties , returns the property as in the [key,value] pair?

for eg, if i have a property such as
java.rmi.server.randomIDs=true,

then the call

getProperty("java.rmi.server.randomIDs")

returns

java.rmi.server.randomIDs=true
OR
true

Please let me know.

Thanks, Nishi.
 
K

Karthik

Nishi said:
Hi:

I needed to know whether the getProperty(..) method in java.util.Properties , returns the property as in the [key,value] pair?

for eg, if i have a property such as
java.rmi.server.randomIDs=true,

then the call

getProperty("java.rmi.server.randomIDs")

returns

java.rmi.server.randomIDs=true
OR
true

Please let me know.

Thanks, Nishi.
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#getProperty(java.lang.String)
..

says it all !!

Rule #1 for all newbies - plz get the documentation (it does not come
with the SDK ) and look into the same.

HTH
 
J

Jim

Nishi said:
Hi:

I needed to know whether the getProperty(..) method in java.util.Properties , returns the property as in the [key,value] pair?

for eg, if i have a property such as
java.rmi.server.randomIDs=true,

then the call

getProperty("java.rmi.server.randomIDs")

returns

java.rmi.server.randomIDs=true
OR
true

Please let me know.

Thanks, Nishi.
Of course you could have looked in the javaDocs or written a little

test program such as

import java.util.Properties;

public class PropTest {
public static void main(String [] args) {
Properties p = new Properties();
p.setProperty("java.rmi.server.randomIDs","true");

System.out.println(p.getProperty("java.rmi.server.randomIDs"));
}
}

Jim
 
C

Christophe Vanfleteren

Nishi said:
Hi:

I needed to know whether the getProperty(..) method in
java.util.Properties , returns the property as in the [key,value] pair?

for eg, if i have a property such as
java.rmi.server.randomIDs=true,

then the call

getProperty("java.rmi.server.randomIDs")

returns

java.rmi.server.randomIDs=true
OR
true

Please let me know.

Thanks, Nishi.

Please, in the future, consult the Javadocs first. It should be clearly
explained what the method returns.

And you could have tested this yourself writing only a few lines of code.
Don't be this lazy again please.
 
L

Liz

and i thought i was lazy


Nishi Bhonsle said:
Hi:

I needed to know whether the getProperty(..) method in
java.util.Properties , returns the property as in the [key,value] pair?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top