package Hola;
import java.io.*;
import javax.swing.JOptionPane;
public class Jade {   
   public static void main (String args[])throws IOException{      
      new RandomAccessFile("archivo.txt", "rw");         
      String telefono;
      String opc;
      int respuesta=1;
      String nombre;
      String direccion;               
      String resul;            
      while(respuesta==1)
      {
     opc=JOptionPane.showInputDialog(null, "Desea ingresar un nuevo contacto  SI=1 NO=2");    
     respuesta=Integer.parseInt(opc);     
     if(respuesta==1){
        BufferedWriter bw=new BufferedWriter(new FileWriter("archivo.txt"));
         PrintWriter salida=new PrintWriter(bw);     
       nombre=JOptionPane.showInputDialog(null, "ingrese el nombre");
        direccion=JOptionPane.showInputDialog(null, "ingrese la direccion");
        telefono=JOptionPane.showInputDialog(null,"ingrese el numero de telefono");                                       
         salida.println(" "+ nombre + telefono +direccion);                                                   
         salida.close();                
     }      
      }            
        if  (respuesta==2)        
        JOptionPane.showMessageDialog(null,"Hasta luego");                      
   }
.................ahi esta el cofigo haber si alguien le exa un vistazo!!! lo agradeceria mucho 
