- The argument list must exactly same that of the overridden method. If they don't match, you can end up with an overloaded method.
- The return type must be the same as, or a sub-type of, the return type declared in the original overridden method in the super-class (also called co-variant return type).
- Instance methods can be overridden only if they are inherited by the subclass.
- A subclass within the same package as the instance's super-class can override any super-class method that is not marked private or final. A subclass in a different package can override only those non-final methods marked public or protected (since protected methods are inherited by the subclass).
- The overriding method can throw any unchecked (run-time) exception, regardless of whether the overridden method declares the exception.
- The overriding method must not throw checked exceptions that are new or broader than those declared by the overridden method. For example, a method that declares a FileNotFoundException cannot be overridden by a method that declares a SQLException, Exception, or any other non-run-time exception unless it's a subclass of FileNotFoundException.
- You cannot override a method marked final.
- You cannot override a method marked static.
- If a class is not inherited, you cannot override its methods.
Whenever we try to export excel of huge data (for ex: around 200000-300000 records), most of the time we end up with OutOfMemoryError:JavaHeapSpace. And also consuming more time to process or export that much of data. Main reason to this kind of problem is that, the prior version of Apache POI (prior to 3.8) will not provide proper solution for this kind of situations and also we have other issues with the API designed with those versions. Even I had faced issues of not supporting more than 65000 rows of data during exporting excel with prior versions of POI. But with the version 3.8 and higher they come with solutions for all these problems. To resolve Memory issue and performance issue of Excel Export they have utilized stream API to design their API to support huge data export and performance issues. With stream API we can flush only few rows of data into the Memory and reamining we can flush to the hard memory (permanent Memory). In this example y…