// Create the token cancel airdrop transaction
TokenCancelAirdropTransaction transaction = new TokenCancelAirdropTransaction()
.addPendingAirdropId(pendingAirdropId)
.freezeWith(client);
// Sign with the sender account key and submit the transaction to a Hedera network
TransactionResponse txResponse = transaction.sign(accountKey).execute(client);
// Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
// Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status: " + transactionStatus.toString());
// v2.51.0