HTML

How to Convert String to LocalDateTime in Java 8 - Example Tutorial

Hello guys, today, I will talk about a common problem while working in a Java application, yes you guessed it right, I am talking about String to Date conversion in Java. I had discussed this before (see the Date to String) when Java 8 was not out, but with Java 8, I don't see any reason to use old date and time API, and hence I am writing this post to teach you how to convert String to Date in Java 8 or beyond. Suppose you have a date-time String "2016-03-04: 11:01:20" and you want to convert this into a LocalDateTime object of Java 8 new date and time API, how do you do that? Well, if you have worked previously with String and Date then you know that you can parse String to Date in Java.

Is it Possible to Create Object or Instance of an Abstract class in Java?

Hello guys, how are you doing? Hope you are doing well. It's been long since  I shared a core Java interview question in this blog, so let's start with that. Earlier I have shared one of the frequently asked questions in Java, can we make an abstract class final in Java and my readers really liked and asked for more such questions. So, today I am going to talk about whether you can create an instance of an Abstract class in Java or not? This is another interesting core Java question that you will find on telephonic interviews, a written test that has multiple-choice questions and most notably Oracle certified Java programmer certification like OCAJP 8  and OCAJP 11.

Difference between the getRequestDispatcher and getNamedDispatcher in ServletContext?

The ServletContext class provides two methods getRequestDispatcher(String url-pattern) and getNamedDispatcher(String name), which can be used to dispatch a request to a particular servlet. The main difference between getRequestDispatcher() and getNamedDispatcher() method is that former accepts a URL pattern or path while later agrees with a Servlet name defined in deployment descriptor or web.xml file, both return an instance of RequestDispatcher class, which can further use to forward or redirect a request in Java web application. Let' see some more detail about these two methods and how they work.