Add order comment programmatically in magento2

$orderIncrementId='xxxxxxxxx1';
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->loadByIncrementId($orderIncrementId);
$order->addStatusHistoryComment('This comment is programatically added to last order in this Magento setup');
$order->save();

Comments