• 20 January

    Java program to print Diamond pattern

    In this tutorial, we will see java program to print diamond pattern. [crayon-6621e2db130a0580658981/] That’s all about printing diamond pattern in java.

  • 02 January

    Interface Segregation Principle in java

    In this tutorial, we will learn about Interface Segregation Principle.It is one of the SOLID principles. In simple term, Interface Segregation Principle dictates that client should not be forced to implement the methods which it won’t be able to use.You can always throw UnsupportedOperationException from the method which you don’t want to use but it […]

  • 02 January

    Open Closed Principle in Java

    In this tutorial, we will learn about Open Closed Design Principle in Java.Open closed principle is one of the SOLID principles. Open Closed Design Principle dictates that “software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification”. This definition was provided by Bertrand Meyer. Once we have written the class and […]

  • 28 December

    Single Responsibility Principle in Java

    In this tutorial, we will learn about single responsibility principle in java.It is one of SOLID principles and simplest design principle as well. Single responsibility principle dictates that there should be only one reason to change the class.If you have more than one reason to change the class then refactor the class into multiple classes according […]

  • 24 December

    Reverse number in java

    In this post, we will see how to reverse a number in java. Here is simple program to reverse a number. [crayon-6621e2db14cd5588956177/] Output: Enter a Number : 4567 Reverse of the number : 7654 Let’s just observe values of variables at the end of each iteration. Iteration 0: number = 4567,remainder = 0, reversedNumber = […]

  • 04 November

    Can we overload main method in java

    In this post, we will see about "Can we overload main method in java".This is one of the most asked Core java interview questions. Yes, we can overload main method in java but when you run your program, JVM will search for public static void main(String[] args) and execute that method. Overload main method in […]

  • 02 November

    Dynamic method dispatch in java

    In this post, we will about Dynamic method dispatch which is also referred as run time polymorphism. Dynamic Method Dispatch Dynamic method dispatch is a technique by which call to a overridden method is resolved at runtime, rather than compile time.When an overridden method is called by a reference, then which version of overridden method […]

  • 29 October

    Can we override static method in java

    No, we can not override static method in java. Static methods are those which can be called without creating object of class,they are class level methods. On other hand,If subclass is having same method signature as base class then it is known as method overriding. Its execution decided at run time. Below are the reasons why […]

  • 27 October

    Count number of words in a string

    In this post, we will see how to find number of words in a String. Problem Find the number of words in a String. For example: There are 6 words in below String welcome to java tutorial on Java2blog Algorithm The algorithm will be very simple. Initialize count with 1 as if there are no […]