# VBForums CodeBank > CodeBank - Java / J# >  Java - Working with Properties

## Dillinger4

In later sections i am going to show how you can restrict access to web pages using http based authorization. Properties will be integrated into this application so i wanted to start with some of the easier parts. Working with Properties is quite easy. The following code simply writes three properties to a file in name:value pair combinations then reads them back printing them on the command line. 


```
 
 import java.io.*; 
 import java.util.*; 

 class XmlProp{
  public static void main(String[] args) {
  try{
  OutputStream fos = new FileOutputStream("C:\\Passwords"); 
  Properties pws = new Properties();
  pws.setProperty("Red","6546");
  pws.setProperty("Blue","9878");
  pws.setProperty("Green","5609");
 
  pws.store(fos,"Passwords"); 
  Enumeration pns = pws.propertyNames(); 
   while(pns.hasMoreElements()){
    String key = (String) pns.nextElement();
    String prop = pws.getProperty(key); 
    System.out.println("key:value " + key + ":" + prop);
    }
   }catch(IOException io){System.err.println(io);}
  }
 }
```

----------


## System_Error

Is Properties a class in Java, or are you creating this yourself?

----------


## Dillinger4

> *Posted by System_Error*
> 
> Is Properties a class in Java, or are you creating this yourself?


In Java. It's found in the java.util package. It extends java.util.Hashtable

----------

