Magento 2 get product collection

You can use the below code for get the product collection
Magento 2 get product collection
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productCollection */
$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection');

$collection = $productCollection->addAttributeToSelect('*')
            ->load();

foreach ($collection as $product){
     echo $product->getName().'<br>';
}  
?>

expoundsofttechsolutionMagento 2 get product collection