public void updateSample(String id) {
    try {
      // Create an sObject of type contact
      SObject updateContact = new SObject();
      updateContact.setType("Contact");

      // Set the ID of the contact to update
      updateContact.setId(id);
      // Set the Phone field with a new value
      updateContact.setField("Phone", "(415) 555-1212");

      // Create another contact that will cause an error
      // because it has an invalid ID.
      SObject errorContact = new SObject();
      errorContact.setType("Contact");
      // Set an invalid ID on purpose
      errorContact.setId("SLFKJLFKJ");
      // Set the value of LastName to null
      errorContact.setFieldsToNull(new String[] {"LastName"});

      // Make the update call by passing an array containing
      // the two objects.
      SaveResult[] saveResults =
          partnerConnection.update(new SObject[] {updateContact, errorContact});
      // Iterate through the results and write the ID of
      // the updated contacts to the console, in this case one contact.
      // If the result is not successful, write the errors
      // to the console. In this case, one item failed to update.
      for (int j = 0; j < saveResults.length; j++) {
        System.out.println("\nItem: " + j);
        if (saveResults[j].isSuccess()) {
          System.out.println("Contact with an ID of " + saveResults[j].getId() + " was updated.");
        } else {
          // There were errors during the update call,
          // go through the errors array and write
          // them to the console.
          for (int i = 0; i < saveResults[j].getErrors().length; i++) {
            Error err = saveResults[j].getErrors()[i];
            System.out.println("Errors were found on item " + j);
            System.out.println("Error code: " + err.getStatusCode().toString());
            System.out.println("Error message: " + err.getMessage());
          }
        }
      }
    } catch (ConnectionException ce) {
      ce.printStackTrace();
    }
  }