Design Pattern

Design patterns are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customise to solve a recurring design problem in your code. You can’t just find a pattern and copy it into your program, the way you can with ……………

GSON to Fetch/Parse JSON in Android

This tutorial will cover how to fetch JSON from assets folder and parse it. We will use GSON, a JSON parsing library developed by Google, to quickly parse the JSON into Java objects with very minimal work required.

Error:java.lang.OutOfMemoryError: GC overhead limit exceeded

Error Log

Reflection to Extract Annotation Details

In my this tutorial, I am going to demonstrate how to extract method details with Annotation details with Reflection mechanism.  Have a look on complete details and let me know if I you need some more details.   Below interface is @Retention.RUNTIME Annotation enabled.     

……………

Overriding

The ability to define behaviour that’s specific to a particular subclass type. It means a method is implemented in superclass and subclass has some specific behaviour so subclass is free to implement the same method again.  This concept is called as overriding. Important Points Inheritance is required to achieve Overriding. Overriding is runtime polymorphism. ……………

Overloading

Overloaded methods allows to reuse the same method name in a class, but having different signature. Signature means one method varies with other method in terms of below points: Number of arguments. Types of arguments. Order of arguments. There are some rules as below: Overloaded methods must ……………

Abstract Class

Abstract class is the class which can hold fully implemented methods and unimplemented methods. That’s the major difference between Interface vs Abstract class. Have a look on below section 1.0, which demonstrate template for Abstract class.

Some key points about above demo:  abstract keyword is used. ……………

Interface

Interface and its usage Interface is a 100% abstract class. It means its method should not have its body part. Signatures below: User version

Some key points for above demo: 1)  Keyword “interface” used here for declaring it. 2) No method body. No curly braces like {…}. ……………

Interface vs Abstract Class

Interface  Click here for complete interface explanation. Can have only unimplemented methods. Supports multiple inheritance Can have only static and final variables. Methods can’t be static. Interface can’t hold main method or constructor. Interface can’t extend/implement abstract class. Keyword ‘interface’ is used to declare. Interface can extend other ……………