How to get product availability status in Magento 2

How to get product availability status in Magento 2 First of all load a product id using the object manager code: How to get product availability status in Magento 2expoundsofttechsolution How to get product availability status in Magento 2
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('\Magento\Catalog\Model\Product')->load($_product->getId());


?>
Then get the availability status using the following code:
<?php

 $product_qty = $product['quantity_and_stock_status']['is_in_stock'];
?>
you can print the product availability status using this following condition:

<?php if ($product_qty > 0){?>
    
        <div class="stock available" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
            <span><?= $block->escapeHtml(__('In stock')) ?></span>
        </div>
<?php }
else{
	?>
        <div class="stock unavailable" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
            <span><?= $block->escapeHtml(__('Out of stock')) ?></span>
        </div>
<?php }?>