DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Curious about the future of data-driven systems? Join our Data Engineering roundtable and learn how to build scalable data platforms.

Data Engineering: The industry has come a long way from organizing unstructured data to adopting today's modern data pipelines. See how.

Threat Detection: Learn core practices for managing security risks and vulnerabilities in your organization — don't regret those threats!

Managing API integrations: Assess your use case and needs — plus learn patterns for the design, build, and maintenance of your integrations.

Core Badge
Avatar

Naresh Joshi

DZone Core CORE

Tech Lead App Developer at BNY Mellon

Dehradun, IN

Joined Jun 2016

https://www.programmingmitra.com

About

I am a Software Engineer by profession, Learner and Blogger by passion. I love to talk and discuss with peoples so if you have anything good to read, watch, share or you just want to talk to me you can contact me anytime.

Stats

Reputation: 2037
Pageviews: 1.9M
Articles: 20
Comments: 79
  • Articles
  • Comments

Articles

article thumbnail
Five Different Ways to Create Objects in Java
A list of five ways to create objects in Java, how they interact with constructors, and an example of how to utilize all of these methods.
Updated September 9, 2020
· 318,717 Views · 53 Likes
article thumbnail
How To Install Multiple Versions of Java on the Same Machine
SDKMan! is a tool for managing parallel versions of multiple Software Development Kits on most Unix-based systems. Read more!
Updated September 7, 2020
· 179,076 Views · 24 Likes
article thumbnail
Why the Instance Variable of the Super Class Is Not Overridden in the Sub Class
Need help understanding why the instance variable of the super class is not overridden in the subclass? Check out this post where we answer this question.
Updated September 7, 2020
· 115,286 Views · 20 Likes
article thumbnail
Java Integer Cache: Why Integer.valueOf(127) == Integer.valueOf(127) Is True
So here's the cache...
Updated September 3, 2020
· 36,281 Views · 17 Likes
article thumbnail
How Does JVM Handle Polymorphism Internally
Find out how JVM utilizes method overloading and method overriding.
November 21, 2019
· 9,380 Views · 10 Likes
article thumbnail
Java Serialization Magic Methods and Use Cases
Want to encrypt/decrypt sensitive info before serializing/de-serializing it? Java's got you covered.
September 10, 2019
· 19,616 Views · 8 Likes
article thumbnail
How to Customize Serialization in Java Using the Externalizable Interface
Learn more about custom Java serialization using the Externalizable interface.
Updated September 3, 2019
· 55,739 Views · 8 Likes
article thumbnail
How to Deep Clone an Object Using Java In-Memory Serialization
Check out this post in a series on Java cloning and serialization.
August 21, 2019
· 12,762 Views · 4 Likes
article thumbnail
Java Cloning: Copy Constructors vs. Cloning
Let's run through the pros and cons of Object.clone() and see how it stacks up against copy constructors when it comes to copying objects.
Updated August 20, 2019
· 229,795 Views · 21 Likes
article thumbnail
Shallow and Deep Java Cloning
While not recommended, cloning is a viable way to copy an object. Let's dive into Shallow Cloning, Deep Cloning, how to use them both, and when to avoid them.
Updated August 19, 2019
· 105,886 Views · 12 Likes
article thumbnail
Java Cloning: Even Copy Constructors Are Not Enough
Copy constructors are helpful, but they aren't polymorphic. A no-argument method can help bridge the gap to keep your code loosely coupled and easy to clone.
Updated August 19, 2019
· 29,308 Views · 18 Likes
article thumbnail
Everything You Need to Know About Java Serialization Explained
Here's everything you need to know about serialization in Java.
Updated August 14, 2019
· 122,737 Views · 29 Likes
article thumbnail
Useful Git Commands
For those looking to use the most popular repository storage site in software development, check out these commands that will get you started.
January 30, 2019
· 37,803 Views · 60 Likes
article thumbnail
Variable Shadowing and Hiding in Java
Let's take a look at the fundamental practices of variable shadowing and hiding in Java, they work, and some advice on how best to use them.
Updated February 16, 2018
· 83,477 Views · 16 Likes
article thumbnail
Autowiring Spring Beans Into Classes Not Managed by Spring
Here's a quick and easy utility class that lets you autowire your Spring-managed beans into classes that Spring isn't managing.
Updated July 5, 2017
· 144,477 Views · 20 Likes
article thumbnail
Everything About Method Overloading vs. Method Overriding
Here is a comprehensive breakdown of overloading, overriding, the rules that govern both, and the situations that they work best for.
June 12, 2017
· 118,323 Views · 18 Likes
article thumbnail
JPA Auditing: Automatically Persisting Audit Logs Using EntityListeners
When creating audit logs, consider using Spring Data. Its JPA functionality allows for EntityListeners and callback methods to update the needed properties.
May 27, 2017
· 75,308 Views · 21 Likes
article thumbnail
Spring Data JPA Auditing: Automatically Saving the Good Stuff
Auditing provides valuable information, but it can be a nightmare to implement. Fortunately, through Spring Data JPA, you can persist the columns you need.
May 24, 2017
· 149,435 Views · 28 Likes
article thumbnail
Why an Outer Class Can’t Be Static
Feeling the temptation to define your outer classes as static? See why that's not such a good idea.
October 16, 2016
· 28,907 Views · 11 Likes
article thumbnail
Why Java Is a Purely Object-Oriented Language... Or Why Not
Java—is it actually object-oriented? Let's take a look deep into Java to try to figure it out.
June 16, 2016
· 31,304 Views · 9 Likes

Comments

JPA Auditing: Automatically Persisting Audit Logs Using EntityListeners

Jul 04, 2023 · Mike Gates

Thanks for sharing the information Simon

Java Cloning: Even Copy Constructors Are Not Enough

Jul 04, 2023 · Naresh Joshi

Thanks, Adam & Mike!

How Does JVM Handle Polymorphism Internally

Jul 04, 2023 · Naresh Joshi

Thanks for sharing the information Alex!

Everything You Need to Know About Java Serialization Explained

Jan 15, 2022 · Lindsay Burk

Thanks, Yasin!

Everything You Need to Know About Java Serialization Explained

Jan 15, 2022 · Lindsay Burk

Thanks, Pouria!

Everything You Need to Know About Java Serialization Explained

Jan 15, 2022 · Lindsay Burk

We do not use it in day-to-day code and there but it is used for some of the things under the hood, It is better to know these things.

How To Install Multiple Versions of Java on the Same Machine

Jan 15, 2022 · Lindsay Burk

I agree with you Jhon, There are several approaches to do the same thing!

Shallow and Deep Java Cloning

Jan 15, 2022 · Mike Gates

Thanks, Vaishnavi!

Five Different Ways to Create Objects in Java

Oct 22, 2020 · Naresh Joshi

Thanks @Sanat

Five Different Ways to Create Objects in Java

Oct 22, 2020 · Naresh Joshi

Thanks @Rahul

Five Different Ways to Create Objects in Java

Sep 08, 2020 · Naresh Joshi

Thanks for checking it Mohan, I will update this.

Five Different Ways to Create Objects in Java

Sep 08, 2020 · Naresh Joshi

Haha! Does not matter how much they try to deprecate it but it will be always there.

Five Different Ways to Create Objects in Java

Sep 08, 2020 · Naresh Joshi

Yes, I agree!

Five Different Ways to Create Objects in Java

Sep 08, 2020 · Naresh Joshi

Thanks for sharing it! @Esko

Five Different Ways to Create Objects in Java

Sep 08, 2020 · Naresh Joshi

Yeah, I agree! Wrote that statement just to make the distinction.

Five Different Ways to Create Objects in Java

Sep 08, 2020 · Naresh Joshi

Thanks @Gayatri

Why the Instance Variable of the Super Class Is Not Overridden in the Sub Class

Sep 04, 2020 · Lindsay Burk

@Suxin Li Sorry for replying late, As mentioned it the article,

We know every Child class inherits variables and methods (state and behavior) from its Parent class. Imagine if Java allows variable overriding and we change the type of a variable from int to Object in the Child class. It will break any method using that variable, and because the child has inherited those methods from the Parent, the compiler will give errors in the Child class.


It not just about what method returns, It is about what variable method is using,

7 Crucial Questions About Quantum Computing and Cybersecurity

Jan 19, 2020 · Alan Grau

Great details Alan! Thanks for sharing.

Java Serialization Magic Methods and Use Cases

Oct 19, 2019 · Lindsay Burk

Thanks Amit.!

How to Customize Serialization in Java Using the Externalizable Interface

Sep 04, 2019 · Lindsay Burk

Thanks Amit!

Useful Git Commands

Jul 22, 2019 · Duncan Brown

Thanks Divya!

Variable Shadowing and Hiding in Java

Jul 16, 2019 · Mike Gates

Thanks Ravindra!

Autowiring Spring Beans Into Classes Not Managed by Spring

Jul 07, 2019 · Mike Gates

Thanks! @Atul

IntelliJ, Scala and Gradle: Revisiting Hell

Jun 14, 2019 · James Sugrue

I am facing the same kind of integration problems with scala, gradle and intellij, If I compile the project through gradle it compiles successfully but intellij is not so intelligent to compile it.

Java's Future-Looking Projects: Panama, Loom, Amber, and Valhalla

May 30, 2019 · Lindsay Burk

Thanks for combining these features in one article, excited to see them.

How To Install Multiple Versions of Java on the Same Machine

Apr 16, 2019 · Lindsay Burk

Thanks for mentioning it @Ravi Hasija

How To Install Multiple Versions of Java on the Same Machine

Apr 08, 2019 · Lindsay Burk

Thanks @Raghavan!

How To Install Multiple Versions of Java on the Same Machine

Apr 08, 2019 · Lindsay Burk

As mentioned in the blog "Because SDKMan is written in bash and only requires curl and zip/unzip to be present on your system. You can install SDKMan on Windows as well either by first installing Cygwin or Git Bash for Windows environment and then installing SDKMan by running mentioned commands."

Java Cloning: Copy Constructors vs. Cloning

Apr 03, 2019 · Mike Gates

Hi Andreas! Thanks for mentioning, I was trying to focus on the concept only.

Autowiring Spring Beans Into Classes Not Managed by Spring

Apr 01, 2019 · Mike Gates

Thanks!

Useful Git Commands

Feb 18, 2019 · Duncan Brown

Thanks Miten! Will do that in near future.

Useful Git Commands

Feb 07, 2019 · Duncan Brown

Thanks Brian! I appreciate it!

Useful Git Commands

Feb 05, 2019 · Duncan Brown

Thanks, Sunit! Thanks for your response!

Why the Instance Variable of the Super Class Is Not Overridden in the Sub Class

Nov 16, 2018 · Lindsay Burk

Thanks Silvia!

Why the Instance Variable of the Super Class Is Not Overridden in the Sub Class

Nov 16, 2018 · Lindsay Burk

Thanks!

Using Google Cloud Text-to-Speech With Java

Apr 03, 2018 · Mike Gates

Hi Ajitesh, Gcloud provides it for free or it costs?

A Guide to Streams: In-Depth Tutorial With Examples

Mar 26, 2018 · Duncan Brown

Nice article Eugen!, I am using streams for 2 years but was not aware of some methods discussed by here.

Cheatsheet: Java Functional Interfaces

Mar 26, 2018 · Tony Tapper

Nice summary!

5 Hidden Secrets in Java

Feb 21, 2018 · Justin Albano

mention not.

5 Hidden Secrets in Java

Feb 21, 2018 · Justin Albano

Good article Justin, I was not aware of most of them. I also wanted to point out that static initializers get called when the class loads into the memory not when the application starts. This will happen if our class is getting loaded into memory during application start.

Variable Shadowing and Hiding in Java

Feb 20, 2018 · Mike Gates

Thanks Denis!

Autowiring Spring Beans Into Classes Not Managed by Spring

Feb 06, 2018 · Mike Gates

Thanks, Effie, I can't help without seeing your code, you can complete code for this blog on https://github.com/njnareshjoshi/articles/tree/master/spring-data-jpa-auditing, tell me if this helps.

Autowiring Spring Beans Into Classes Not Managed by Spring

Feb 06, 2018 · Mike Gates

Yes you can

Spring Transaction Management Over Multiple Threads

Aug 14, 2017 · Dulaj Atapattu

The link "Adroitlogic Project-X" is broken, can you please share some code or git repo.

Shallow and Deep Java Cloning

Aug 04, 2017 · Mike Gates

Thanks, Anastasiia, Your research about hiring a Java devs is good.

Autowiring Spring Beans Into Classes Not Managed by Spring

Jul 12, 2017 · Mike Gates

Ohh my god, I think you are not in a good mood today and I know your time is very precious so don't waste your time in posting shit comments on a shit article and do something productive.

7000 more readers have read it and did not found it shit, you found it shit that's your perception, I thank you for telling me your perception.

By the way, I have not posted it on DZone and They have picked it and I am pretty sure they have done this for a good and productive reason.

Autowiring Spring Beans Into Classes Not Managed by Spring

Jul 12, 2017 · Mike Gates

Thanks a lot, Really nice to hear that at least you have something to say.

Autowiring Spring Beans Into Classes Not Managed by Spring

Jul 07, 2017 · Mike Gates

Yes, you are right but sometimes based on our requirements we need these kinds of things e.g. I have to do a lookup.

Autowiring Spring Beans Into Classes Not Managed by Spring

Jul 07, 2017 · Mike Gates

Totally agreed.

Java Cloning: Copy Constructors vs. Cloning

Jul 06, 2017 · Mike Gates

Thanks for mentioning, I was totally unaware of it.

Everything About Method Overloading vs. Method Overriding

Jun 15, 2017 · Mike Gates

Okay, thanks!!!

Everything About Method Overloading vs. Method Overriding

Jun 15, 2017 · Mike Gates

Good point

Everything About Method Overloading vs. Method Overriding

Jun 15, 2017 · Mike Gates

Having an opinion is good but forcing it on others is not. However, I accept what you are trying to say that novice programmers might get confused but chances are very less. Because anybody can see the code and can also see that the method is not static.

Everything About Method Overloading vs. Method Overriding

Jun 15, 2017 · Mike Gates

I don't want to get into a fight here but you are completely wrong here, I am not saying that we should always override it but we should when we are in need.

My whole purpose was to talk about override and overload not equals and hashCode and their contract.

And what are you trying to prove by saying "including the author." , First of all, this not something a professional says and it does not suite to a person who has this much experience. We should be a little bit polite and give respect to others.

And assuming what others don't know because of what you know is not a good idea.

Everything About Method Overloading vs. Method Overriding

Jun 15, 2017 · Mike Gates

Totally agreed.

Everything About Method Overloading vs. Method Overriding

Jun 15, 2017 · Mike Gates

Agreed We will not be overriding those methods always as I have not done in the example. But whenever we work on a real time project we should and it is good to implement those methods in your classes specially POJOs.

Everything About Method Overloading vs. Method Overriding

Jun 14, 2017 · Mike Gates

It is not required but we can use a different return type but must use different argument.

Shallow and Deep Java Cloning

Jun 01, 2017 · Mike Gates

I apologize for your inconvenience but DZone Have picked it up from my blog, I have not posted it.

I am pretty sure that they have done it for some good reason.

JPA Auditing: Automatically Persisting Audit Logs Using EntityListeners

May 29, 2017 · Mike Gates

Yes We can store all the request info as well e.g. headers, params, url, body etc.

Spring Data JPA Auditing: Automatically Saving the Good Stuff

May 28, 2017 · Mike Gates

Certainly, Hibernate Envers have an edge over JPA auditing. And actually, this article is the first in the 3 article long auditing series which I am working on next is https://programmingmitra.com/2017/02/automatic-jpa-auditing-persisting-audit-logs-automatically-using-entityListeners.html

And I am going to write the 3rd article which will be about hibernate-envers

Introducing Bolt, Neo4j's Upcoming Binary Protocol – Part 1

May 28, 2017 · Duncan Brown

This conversation solved my confusion.

Java Cloning: Even Copy Constructors Are Not Enough

Feb 05, 2017 · Naresh Joshi

Because we want to hide the copy constructor and instead use our defensive copy method for copying.

Java Cloning: Even Copy Constructors Are Not Enough

Jan 26, 2017 · Naresh Joshi

because we don't want them to be accessible outside of the class, we will call them from our defensive copy method only

Java Cloning: Even Copy Constructors Are Not Enough

Jan 25, 2017 · Naresh Joshi

Even though we have done that in equal operation and it would have returned true but still we are getting different object after cloning

Java Cloning: Even Copy Constructors Are Not Enough

Jan 25, 2017 · Naresh Joshi

Thanks for noticing buddy, it was a typo and I have corrected it.

Java Cloning: Even Copy Constructors Are Not Enough

Jan 25, 2017 · Naresh Joshi

Yes surely, thanks for mentioning

Java Cloning: Even Copy Constructors Are Not Enough

Jan 25, 2017 · Naresh Joshi

Yes you are right, but aren't dynamic dispatch and polymorphism same things?

Java Cloning: Even Copy Constructors Are Not Enough

Jan 25, 2017 · Naresh Joshi

Yes surely, copy constructors should be private I forgot this. Thanks

What Is Node.js for Java Developers?

Dec 30, 2016 · Ratha KM

Very nice and explanative article, Thank you!!!!

Why an Outer Class Can’t Be Static

Oct 19, 2016 · Naresh Joshi

Yes you are right,Thanks for your answers

Why Java Is a Purely Object-Oriented Language... Or Why Not

Oct 19, 2016 · Naresh Joshi

Thanks Robert, I will

Why Java Is a Purely Object-Oriented Language... Or Why Not

Oct 18, 2016 · Naresh Joshi

Java 8 lambdas get converted to invokedynamic, And sorry but I don't have idea how that works

Why Java Is a Purely Object-Oriented Language... Or Why Not

Oct 18, 2016 · Naresh Joshi

java.lang.Class is actually the internal structure of your class, everytime JVM loads a class into memory it creates an object of java.lang.Class<YourClass> in PermGenSpace.

And As I have mentioned in another comment In the source code of java.lang.Class, you can clearly see that "The primitive Java types (boolean, byte, char, short, int, long, float, and double), and the keyword void are also represented as Class objects."

If you study all the point which I have written in favor of "Why Java is a purely Object Oriented language", you clearly say even if these are primitive for developers, JVM internally treats them as objects.

Why Java Is a Purely Object-Oriented Language... Or Why Not

Oct 18, 2016 · Naresh Joshi

As I mentioned in a previous comment, primitives are not objects for us, JVM treats them as some kind of internal objects on which we are not allowed to perform any operation as we can on objects.

Why Java Is a Purely Object-Oriented Language... Or Why Not

Oct 18, 2016 · Naresh Joshi

I agree

Why Java Is a Purely Object-Oriented Language... Or Why Not

Oct 18, 2016 · Naresh Joshi

Yes, I understood your point and I agree to it but Just try to read the source code of java.lang.Class, you will clearly see that "The primitive Java types (boolean, byte, char, short, int, long, float, and double), and the keyword void are also represented as Class objects."

If you study all the point which I have written in favor of "Why Java is a purely Object Oriented language", you clearly say even if these are primitive for developers, JVM internally treats them as objects


Why an Outer Class Can’t Be Static

Oct 18, 2016 · Naresh Joshi

I do agree with your second point that outer classes do behave like static and can be understood as static.

But I don't agree on your first point "it's technically held in the JVMs internal structure for the class and not in j.l.Class."

java.lang.Class is actually the internal structure of your class. Everytime JVM loads a class into memory it creates an object of java.lang.Class<YourClass> in PermGenSpace.

Why Java Is a Purely Object-Oriented Language... Or Why Not

Jun 23, 2016 · Naresh Joshi

thanks all for giving your precious time and mentioning your points

Why Java Is a Purely Object-Oriented Language... Or Why Not

Jun 23, 2016 · Naresh Joshi

thanks Michael, i have corrected it.

User has been successfully modified

Failed to modify user

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: