Category: 09. OOPs Misc

  • Difference between method overloading and method overriding in java

    There are many differences between method overloading and method overriding in java. A list of differences between method overloading and method overriding are given below: No. Method Overloading Method Overriding 1) Method overloading is used to increase the readability of the program. Method overriding is used to provide the specific implementation of the method that is already provided by…

  • Difference between object and class

    There are many differences between object and class. A list of differences between object and class are given below: No. Object Class 1) Object is an instance of a class. Class is a blueprint or template from which objects are created. 2) Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc. Class is a group…

  • Java Command Line Arguments

    The java command-line argument is an argument i.e. passed at the time of running the java program. The arguments passed from the console can be received in the java program and it can be used as an input. So, it provides a convenient way to check the behavior of the program for the different values.…

  • Creating API Document | javadoc tool

    We can create document api in java by the help of javadoc tool. In the java file, we must use the documentation comment /**… */ to post information for the class, method, constructor, fields etc. Let’s see the simple class that contains documentation comment. To create the document API, you need to use the javadoc tool followed…

  • Java Strictfp Keyword

    Java strictfp keyword ensures that you will get the same result on every platform if you perform operations in the floating-point variable. The precision may differ from platform to platform that is why java programming language have provided the strictfp keyword, so that you get same result on every platform. So, now you have better…

  • Call by Value and Call by Reference in Java

    There is only call by value in java, not call by reference. If we call a method passing a value, it is known as call by value. The changes being done in the called method, is not affected in the calling method. Example of call by value in java In case of call by value…

  • Recursion in Java

    Recursion in java is a process in which a method calls itself continuously. A method in java that calls itself is called recursive method. It makes the code compact but complex to understand. Syntax: Java Recursion Example 1: Infinite times Output: Java Recursion Example 2: Finite times Output: Java Recursion Example 3: Factorial Number Output:…

  • Wrapper classes in Java

    The wrapper class in Java provides the mechanism to convert primitive into object and object into primitive. Since J2SE 5.0, autoboxing and unboxing feature convert primitives into objects and objects into primitives automatically. The automatic conversion of primitive into an object is known as autoboxing and vice-versa unboxing. Use of Wrapper classes in Java Java is an object-oriented programming language, so we…

  • Java Math class

    Java Math class provides several methods to work on math calculations like min(), max(), avg(), sin(), cos(), tan(), round(), ceil(), floor(), abs() etc. Unlike some of the StrictMath class numeric methods, all implementations of the equivalent function of Math class can’t define to return the bit-for-bit same results. This relaxation permits implementation with better-performance where…

  • Object Cloning in Java

    The object cloning is a way to create exact copy of an object. The clone() method of Object class is used to clone an object. The java.lang.Cloneable interface must be implemented by the class whose object clone we want to create. If we don’t implement Cloneable interface, clone() method generates CloneNotSupportedException. The clone() method is defined in the Object class. Syntax of…