Why main() method is static in Java?

Why main() method is static in Java? It is a very common Java question that baffles new learners as well as experienced programmers. Very few people know the correct answer of this question. In this post, I will share the real concept behind it. Everything that we define in a class is called a member […]

Portability vs Platform Independency

What is Portability? Portability is the ability to be easily carried or moved. In programming, Portability represents the ability of software to be transferred from one platform to another. Almost all high level languages such as C, C++, Java etc are portable i.e. Their applications can be executed on all platforms. How a language is […]

Encapsulation vs Abstraction

What is Encapsulation? Encapsulation is the process of putting something into a capsule. In programming, Encapsulation represents the grouping of logically related data and operations into blocks called classes. In real life context, a company can encapsulate its stakeholders into the following groups according to their functionalities: Employee, Product, Customer, Supplier, Share holder etc. Encapsulation […]

Example of BodyTag

Practical example of BodyTag: To demonstrate the example of BodyTag, I have created a custom tag which receives its body contents from the tag processor and change the case of body text. Here is the source code of the Tag and other application compoenents: The CaseChangerTag class: package com.techmentro.learningpad; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.*; public class […]

BodyTag interface of Tag API

BodyTag interface: BodyTag is a sub interface of IterationTag. It adds following method to the tag life cycle: setBodyContent: This method facilitate processing of the tag body by the Tag itself. It has following syntax: In addition to this method, the BodyTag interface defines BodyTag.EVAL_BODY_BUFFERED static final int data member to be used as a […]