This is the way we can overriding Block or Model in Magento 2. Sometime when developing a website in Magento 2 we need change something for suitable with the requirement. In this example, I will override Model Order In Magento 2

You can visit this link to create a custom module in Magento 2

First of all, create di.xml file in Folder Techhalls/overriding/etc

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Sales\Model\Order" type="Techhalls\Override\Model\Rewrite\Sales\Order"/>
</config>

Now create Order.php Block file in Folder

<?php
/**
 * Copyright (c) 2018. Techhalls.com
 *
 */

namespace Techhalls\Overriding\Model\Rewrite\Sales;
/**
 * Class Order
 * @package Techhalls\Overriding\Model\Rewrite\Sales
 */
class Order extends \Magento\Sales\Model\Order
{
    /**
     * @param float $price
     * @param bool  $addBrackets
     *
     * @return string
     */
    public function formatPrice($price, $addBrackets = false)
    {
        return $this->formatPricePrecision($price, 0, $addBrackets);
    }

}

In this case, we overriding model Order in Magento 2 then override method format Price. This method will remove 2 decimal price when sending email to a customer.