Japan's economy failed to grow on a quarterly basis during the April-June period, with gross domestic product coming in flat.