Lokesh Gupta
Java developer, founder of HowToDoInJava
I started HowToDoInJava in October 2012 to write down what I learned at work, and the site now has more than 1,600 tutorials on Java, Spring Boot, Hibernate, testing and TypeScript. I have worked on Java and Spring applications for more than 20 years, in roles at Hewitt Associates, Hughes Systique, Adobe and Bank of America.
Every tutorial here is written for a developer with a few years of experience who needs a clear answer and working code. The examples are run on the latest stable versions before they go live, and the full source code is in my GitHub repositories.
Away from the keyboard I play table tennis, badminton and carrom, and I watch a lot of films.
What HowToDoInJava Covers
The tutorials cover the Java stack that most teams use at work. The main areas are core Java (the language, collections, streams, concurrency, date and time, I/O), Spring Boot and the Spring projects (Spring Framework, Security, Data, Batch, Cloud, Spring AI), Hibernate and JPA, testing with JUnit and Mockito, build tools (Maven, Gradle), Apache Kafka, and TypeScript.
How the Tutorials Are Written
Each post starts with the answer, because most readers arrive from a search with a specific problem. The concept comes next, and then a complete, runnable example with real output. I check facts against the official documentation (JEPs, Javadoc, Spring reference docs, release notes), not against other blogs.
Versions matter in Java, so each example states the version it was built with, such as Java 25, Spring Boot 4.1 or JUnit 6. When a library changes, the post and its code are updated, and the last updated date on the page changes only when the content does.
Corrections and Contact
If you find an error, a snippet that no longer compiles, or a better way to do something, leave a comment on the post or reach me on LinkedIn, X or GitHub. Corrections are made in the post itself, and the source code repositories accept pull requests.
For advertising or sponsorship questions, see the advertise page. Sponsored content is marked as such and is never mixed into the tutorials.

Hi Lokesh
I am a Java developer from China. I really like your tutorial. I want to translate it into Chinese and put it on github. I hope to get your permission.
Please add a link to the original tutorial.
I want to join you. Can you give me a Github link?
Your blog is great start point for all beginner or advanced java programmers. Keep it up :)
Simply superb… really nice work lokesh. :)
Hi Lokesh
Really appreciate with your bold articles, i love almost all.
I am just practicing my self for microsevice example. so you have consolidate example, with gateway+ragistry+auth(Oauth 2)+Any service.
If you had please share code with me
If possible can you please share your whats app contact number.
tks for share Java 8 Tutorial.
:)
Hello Sir,
Really loved your blogs.
Please share some good practical reading materials or your blog if any for Apache Kafka with Java and Docker complete example.
Regards,
Salman Khan
Hi,
Can you write an article about why method definition is now allowed in interfaces from Java 10?
Thanks
HI Lokesh, you explain this concurrency topics in a great way, but I cannot find synchronized volatile explained by you.
i want know to use apache library in our website it requires some licence if yes then how please reply fast
No license is needed.
Hi Lokesh,
for some reason your singleton page captcha is not working well, so I post my comment here.
In your Lazy initialization part, you named the double checked version implenetation as EagerSingleton.
public class EagerSingleton { private static volatile EagerSingleton instance = null; // private constructor private EagerSingleton() { } public static EagerSingleton getInstance() { if (instance == null) { synchronized (EagerSingleton.class) { // Double check if (instance == null) { instance = new EagerSingleton(); } } } return instance; } }Since its not an Eager initialization i would recommand changing the class name. Apart from that I like very much your blog.
I will check it. And thanks for letting me know about captcha thing. I will fix it.
hi lokesh..I want to uninstall oracle10gxe.while deleting msvcr71.dll and oci.dll it is showing an error msg that “the action can’t be completed because it is open in windows explorer”.please suggest me how i will delete msvcr71.dll and oci.dll??
Restart the system and kill all oracle processes from windows services or task manager. You should be able to delete all files now.
Just a feedback,… U r awesome! Its a great learning experience for all java developers.
Thanks !!
Hi Lokesh, I am trying to display ebills information when a click on view or pay bill. I am trying to do this using spring mvc hibernate jsp. Regarding this i need to send a detailed mail to your mail id inorder to fix some issues.
howtodoinjava[at]gmail[dot]com
hi
do you have any working examples of spring security using
KeyBasedPersistenceTokenService?
My requirement is to use json/rest architecture with Spring MVC 3 annotations, spring security with token exchange.
thanks
I will work on it.
yeah,I also want a same example where spring security has been implemented with OAuth protocol.OAuth 2.0 is been used by all sites(FB,G+,ebay) to grant permission 3rd party users to use their data.
I’m sure Lokesh will help on this.It would be helpful for him also.
great job.. really good information.. all at one place..
can u explain these problem clearly
2) If the class contains members of any class type then only the object references to those members are copied and hence the member references in both the original object as well as the cloned object refer to the same object.
Read :: https://howtodoinjava.com/java/cloning/a-guide-to-object-cloning-in-java/