Java application created by group of objects. Every time we create object to represent the real time objects. “new” operation creates and builds new object for the class. But real-time scenario, we may require to create exact copy of java object in enterprise application. Below list of use cases to create copy of objects in
Browsing category Java
The Java language supports three types of comments in code to explain the business logic in code, to explain the algorithm logic to other developers in code itself or to generate the document content in coding itself. Single line comments : //…………………. Multi line comments : /* ………………. */ Documentation comments /** Document Content */
We are writing method to accomplish business logic in application. We have to pass the argument to methods for processing. We have to understand how the arguments are passed to methods as “Pass by Value”. Understanding of this is important as we can populate and set the value of object properties in the method body
Earlier we discussed on method overloading, it gives same method name and differ by method signature. If we are not sure about number of argument(but same type) for the method, we can’t write one method of each combination of argument list. Code quality recommends maximum 4 overloaded method(with same name) for easy to use and
“polymorphism” means ‘a state of having many shapes’ or ‘the capacity to take on different forms’. In Java, Polymorphism is an ability to access objects of related classes through a single, uniform interface. Two types of polymorphism in Java, Compile time polymorphism (static binding) Run-time polymorphism (dynamic binding). Method overloading is an example
In Java, instanceof operator is used to check the type of an object at run-time. instanceof operator is important in case of down-casting object at run-time. instanceof operator return boolean value, if an object reference is of specified type then it return true otherwise false. Simple rule is “instanceof” would return true for all the
Method Overloading : Methods have business logic that manipulates data(instances variable). Methods would have method name, input arguments, return type and method body. Sometimes we require to write two methods which are logically same but differ by input argument list. Let us take class “Calculator”. public int add(int a, int b){ return a+ b; } public
In this section we would discuss loops , control statements and decision making condition in java. Always the loops and control statement are just explained as one of the language syntax. But there are so powerful in writing complex business logic. Breaking the loop using break and skipping the remaining part of loop statement by
In the previous post, we have discussed more on abstract class and code re-usability aspect. Now let us discuss on another important artifact of java “interfaces”. Abstract class and interfaces may look(but it is not and never) like same with few differences. But the actual use of interface is totally different from abstract class. An
An abstract class’s purpose is to provide an appropriate super class from which other classes can inherit and thus share a common design. Abstract class would be created to share code among several closely related classes. All the sub-classes extend the abstract class would get all the common methods or fields available in the super









