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 */
Browsing tag: java
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
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
Object oriented programming(OOPS) paradigm enforces code re-usability and avoid redundant code. To implement the code re-usability, OOPS introduces the concept of inheritance. Let see the “Inheritance” definition, A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is
A constructor in Java is a block of code similar to a method that’s called when an instance of an object is created. Constructors are used to initialize the object’s state. Like methods, a constructor also contains collection of statements that are executed at time of Object
Variables are used to store data in java run-time. Methods are used to process access and manipulate the variables. Methods are primary building block in enterprise application as it holds the business logic of an enterprise. Each object in java talks with other objects by invoking methods. Good programmers write in a modular fashion which