Hello guys, in the past, I have discussed several popular and frequently asked Java programs from interviews and coding interview questions and today, I am going to share another popular String based coding interview question for Java developers. The questions goes as - write a method to remove all occurence of a given character from String in Java, you can not use a library method like replace() or remove() which can solve the problem for you. You have to build the logic by yourself. You have to provide both iterative and recursive solution of this question. Along with that, you have to provide some unit test as well, which you can write using JUnit or TestNG testing framework.
Sunday, November 12, 2023
Monday, November 6, 2023
Polymorphism and Open Closed Design Principle Example in Java
Java is an object-oriented programming language that allows developers to create complex software applications by organizing code into objects. One of the key features of object-oriented programming is Polymorphism. Polymorphism refers to the ability of objects to take on different forms, depending on the context in which they are used. In Java, polymorphism is achieved through two mechanisms: inheritance and interfaces. In this blog post, I will explain what polymorphism is in Java, how it works, and provide examples to illustrate its usage. We will also discuss the benefits of using polymorphism in your Java programs, as well as some best practices for implementing it effectively.