Imperative programming sequentially executes statements that may manipulate an underlying state.
Some imperative programming in java:
Customer customer = null;
// first create a customer and have the variable reference it
customer = new Customer();
// the state of the customer variable has changed
// set the id on whatever object is *currently* being referenced by the variable
customer.setId(1);
// the state of the Customer object has changed
customer.setFirstName("Bob");
customer.setLastName("McBob");
Note that if you do the above out of order, it would result in a null pointer exception:
Customer customer = null;
customer.setFirstName("Foo"); // the customer variable is still null at this point
customer = new Customer(); // too late!
Declarative programming doesn't have a state or order, just declarations.
Here is a simple example - this xml snippet could be considered declarative:
<NewCustomers>
<Customer>
<Id>1</Id>
<FirstName>Bob</FirstName>
<LastName>McBob</LastName>
</Customer>
</NewCustomers>
It doesn't talk about how the customer object will get built, just declares the parts. How the above gets interpreted and executed is up to the programming environment.