<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>TheJavaGuy Blog 🚀</title>
    <link>/</link>
    <description>Recent content on TheJavaGuy Blog 🚀</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>Copyright © 2016-2026 Ivan Milosavljević. All Rights Reserved.
</copyright>
    <lastBuildDate>Thu, 30 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Claude Code: Add Plugin to a Project</title>
      <link>/posts/023-claude-code-add-plugin-to-a-project/</link>
      <pubDate>Thu, 30 Apr 2026 00:00:00 +0000</pubDate>
      <guid>/posts/023-claude-code-add-plugin-to-a-project/</guid>
      <description><![CDATA[<p>In <a href="https://claude.com/product/claude-code" target="_blank" rel="noopener noreferrer">Claude Code<i class="fas fa-external-link-square-alt ms-1"></i></a>, sometimes you want to add a plugin to a project instead of adding it to your user settings. You typically want to do that if the project uses a different technology compared to what you normally use, or perhaps you just want to test how a plugin works before installing it to your user scope. Luckily, Claude Code offers a simple way to do that.</p>]]></description><enclosure url="/posts/023-claude-code-add-plugin-to-a-project/cover.png" length="84575" type="image/png" />
    </item>
    
    <item>
      <title>Constructor Rules: Class Must Have at Least One Constructor</title>
      <link>/posts/022-constructor-rules-class-must-have-constructor/</link>
      <pubDate>Thu, 25 Dec 2025 00:00:00 +0000</pubDate>
      <guid>/posts/022-constructor-rules-class-must-have-constructor/</guid>
      <description><![CDATA[<p>In the <a href="/posts/021-the-main-role-of-a-class/">previous article</a>, we&rsquo;ve seen that constructors are the most important members of a class. That conclusion tells us that we must pay special attention to implementing the constructor (or constructors) properly. In this blog post, we&rsquo;ll formulate the first of several constructor rules I believe every class must obey.</p>]]></description><enclosure url="/posts/022-constructor-rules-class-must-have-constructor/cover.png" length="81994" type="image/png" />
    </item>
    
    <item>
      <title>The Main Role of a Class</title>
      <link>/posts/021-the-main-role-of-a-class/</link>
      <pubDate>Thu, 18 Dec 2025 00:00:00 +0000</pubDate>
      <guid>/posts/021-the-main-role-of-a-class/</guid>
      <description><![CDATA[<p>Classes are the bread and butter of Java applications. We write so many of them that sometimes we don&rsquo;t even think of some basic yet fundamental truths. In this blog post we&rsquo;ll take a closer look at the most important role of a class in Java.</p>]]></description><enclosure url="/posts/021-the-main-role-of-a-class/cover.png" length="77548" type="image/png" />
    </item>
    
    <item>
      <title>So what exactly is a whitespace in Java?</title>
      <link>/posts/020-whitespace-in-java/</link>
      <pubDate>Tue, 20 Jun 2023 00:00:00 +0000</pubDate>
      <guid>/posts/020-whitespace-in-java/</guid>
      <description><![CDATA[<p>In our programs we often have to deal with whitespaces, for example to sanitize input we received from users or other applications. With the release of Java 11, there have been some changes to the way whitespace is handled, and it&rsquo;s important for developers to understand these changes in order to avoid potential pitfalls and write efficient, error-free code. In this blog post, we&rsquo;ll take a closer look at whitespace in Java and provide some tips and best practices for working with whitespace in your own Java projects.</p>]]></description><enclosure url="/posts/020-whitespace-in-java/cover.png" length="98022" type="image/png" />
    </item>
    
    <item>
      <title>Adventures of a Java programmer in Character.AI land</title>
      <link>/posts/019-java-programmer-in-character-ai-land/</link>
      <pubDate>Tue, 04 Apr 2023 00:00:00 +0000</pubDate>
      <guid>/posts/019-java-programmer-in-character-ai-land/</guid>
      <description><![CDATA[<p>Usage of artifical intelligence (AI) and large language models (LLM) to write code, comments, documentation etc. is the hottest topic for months now. Most of that attention is directed to the <a href="https://chat.openai.com/" target="_blank" rel="noopener noreferrer">ChatGPT<i class="fas fa-external-link-square-alt ms-1"></i></a> but by no means it&rsquo;s the only game in town. Today I want to explore <a href="https://beta.character.ai/" target="_blank" rel="noopener noreferrer">Character.AI<i class="fas fa-external-link-square-alt ms-1"></i></a> and contrast it to the previous article in which I explored how ChatGPT writes Java code. Character.AI is actually a bunch of differently adjusted models which are known as characters (hence the name) that are claimed to be experts in different skills. The one that caught my attention is called Bug Basher and he claims to be Expert Programmer. Bold claims need bold evidence so let&rsquo;s &ldquo;grill&rdquo; Bug Basher with writing some Java code!</p>]]></description><enclosure url="/posts/019-java-programmer-in-character-ai-land/cover.png" length="100404" type="image/png" />
    </item>
    
    <item>
      <title>Adventures of a Java programmer in ChatGPT land (part 1)</title>
      <link>/posts/018-java-programmer-in-chatgpt-land-part-1/</link>
      <pubDate>Thu, 15 Dec 2022 00:00:00 +0000</pubDate>
      <guid>/posts/018-java-programmer-in-chatgpt-land-part-1/</guid>
      <description><![CDATA[<p>Are you ready to level up your productivity? In this blog post, we&rsquo;ll explore <a href="https://chat.openai.com/" target="_blank" rel="noopener noreferrer">ChatGPT<i class="fas fa-external-link-square-alt ms-1"></i></a>, a powerful and user-friendly language model that can generate Java functions and classes from textual descriptions thus helping you take your Java development to the next level. Read on to learn more!</p>]]></description><enclosure url="/posts/018-java-programmer-in-chatgpt-land-part-1/cover.png" length="78244" type="image/png" />
    </item>
    
    <item>
      <title>3 ways to write higher quality software by using type inference</title>
      <link>/posts/017-3-ways-to-write-higher-quality-software-by-using-type-inference/</link>
      <pubDate>Thu, 08 Dec 2022 00:00:00 +0000</pubDate>
      <guid>/posts/017-3-ways-to-write-higher-quality-software-by-using-type-inference/</guid>
      <description><![CDATA[<p>When hearing the words &ldquo;type inference&rdquo;, most developers probably think of local-variable type inference that arrived in Java 10. But type inference in Java is much older than that. Some sort of it existed even in Java 6, where compilers could infer type parameters of generic constructors! For sure the most famous type inference example is the diamond operator in Java 7. Since the beginning, mere reduction of number of characters used in source code went hand in hand with type inference. But is that its biggest advantage?</p>]]></description><enclosure url="/posts/017-3-ways-to-write-higher-quality-software-by-using-type-inference/cover.png" length="77839" type="image/png" />
    </item>
    
    <item>
      <title>Iterable is beautiful</title>
      <link>/posts/016-iterable-is-beautiful/</link>
      <pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
      <guid>/posts/016-iterable-is-beautiful/</guid>
      <description><![CDATA[<p>Manipulating a group of objects is something every Java developer does almost every day. In those situations, a lot of developers turn to some concrete collections such as <code>ArrayList</code> or <code>HashSet</code> without second thought. More experienced ones try to avoid accepting concrete classes and use some interface like <code>java.util.List</code>, and even more experienced ones turn to <code>java.util.Collection</code>. But sometimes we don&rsquo;t need a collection at all, only the ability to iterate over some objects and for those needs, <code>Iterable</code> is beautiful! Let&rsquo;s see how to improve your programs by using <code>java.lang.Iterable&lt;T&gt;</code>.</p>]]></description><enclosure url="/posts/016-iterable-is-beautiful/cover.png" length="94250" type="image/png" />
    </item>
    
    <item>
      <title>How to install Java 19 (OpenJDK 19) on Windows</title>
      <link>/posts/015-how-to-install-jdk-19-on-windows/</link>
      <pubDate>Thu, 03 Nov 2022 00:00:00 +0000</pubDate>
      <guid>/posts/015-how-to-install-jdk-19-on-windows/</guid>
      <description><![CDATA[<p>Java 19 is currently the latest version of Java. Even though it isn&rsquo;t a LTS release, it&rsquo;s worth installing it so we can test new features. <a href="/posts/014-how-to-install-jdk-19-on-macos/">In one of the previous articles</a> I have written about how to install it on MacOS. In this article I will show you how to install JDK 19 on Windows, add it to the path and to setup IntelliJ IDEA so you can write Java applications against it.</p>]]></description><enclosure url="/posts/015-how-to-install-jdk-19-on-windows/cover.png" length="104098" type="image/png" />
    </item>
    
    <item>
      <title>How to install Java 19 (OpenJDK 19) on MacOS</title>
      <link>/posts/014-how-to-install-jdk-19-on-macos/</link>
      <pubDate>Thu, 22 Sep 2022 00:00:00 +0000</pubDate>
      <guid>/posts/014-how-to-install-jdk-19-on-macos/</guid>
      <description><![CDATA[<p>Java 19 is currently the latest version of Java. Even though it isn&rsquo;t a LTS release, it&rsquo;s worth installing it so we can test new features. In this article I will show you how to install JDK 19 on MacOS and to setup IntelliJ IDEA so you can write Java applications against it.</p>]]></description><enclosure url="/posts/014-how-to-install-jdk-19-on-macos/cover.png" length="120096" type="image/png" />
    </item>
    
    <item>
      <title>Ultimate guide to sorting strings in Java</title>
      <link>/posts/013-ultimate-guide-to-sorting-strings-in-java/</link>
      <pubDate>Thu, 30 Jun 2022 00:00:00 +0000</pubDate>
      <guid>/posts/013-ultimate-guide-to-sorting-strings-in-java/</guid>
      <description><![CDATA[<p>String manipulation is one of the most fundamental tasks of every developer. We create strings, read them, cut them, join them, pad them and generally do dozens of different processing activities on them. One of the most common of those is sorting. On the first glance, sorting looks like an easy and long solved problem… if you&rsquo;re only dealing with 26 letters of an english alphabet that is. For almost any real-world application, sorting is filled with gotchas and intricacies. In this ultimate guide to string sorting I&rsquo;ll dive deeply and answer questions of sorting strings with numbers, in mixed upper case and lower case, with accented letters etc. Fasten your seatbelts!</p>]]></description><enclosure url="/posts/013-ultimate-guide-to-sorting-strings-in-java/cover.png" length="72183" type="image/png" />
    </item>
    
    <item>
      <title>The right tool for the job is a lie</title>
      <link>/posts/012-the-right-tool-for-the-job-is-a-lie/</link>
      <pubDate>Thu, 23 Jun 2022 00:00:00 +0000</pubDate>
      <guid>/posts/012-the-right-tool-for-the-job-is-a-lie/</guid>
      <description><![CDATA[<p>We&rsquo;ve heard it a thousand times already. &ldquo;Use the right tool for the job&rdquo;. It&rsquo;s a very popular phrase between developers. Just look at the number of times it has been mentioned on <a href="https://hn.algolia.com/?dateRange=all&amp;page=0&amp;prefix=true&amp;query=right&#43;tool&#43;for&#43;the&#43;job&amp;sort=byPopularity&amp;type=story" target="_blank" rel="noopener noreferrer">HackerNews<i class="fas fa-external-link-square-alt ms-1"></i></a>. Or search the internet and see enormous number of articles that <a href="https://duckduckgo.com/?q=right&#43;tool&#43;for&#43;the&#43;job&amp;t=h_&amp;ia=web" target="_blank" rel="noopener noreferrer">DuckDuckGo<i class="fas fa-external-link-square-alt ms-1"></i></a> or <a href="https://www.ecosia.org/search?method=index&amp;q=right&#43;tool&#43;for&#43;the&#43;job" target="_blank" rel="noopener noreferrer">Ecosia<i class="fas fa-external-link-square-alt ms-1"></i></a> or any other search engine have on the topic. While it sounds nice and useful, let&rsquo;s first see some issues with this saying, and also what I recommend you to do when feeling paralyzed by the multitude of tools that people preach are <em>the</em> right ones.</p>]]></description><enclosure url="/posts/012-the-right-tool-for-the-job-is-a-lie/cover.png" length="95671" type="image/png" />
    </item>
    
    <item>
      <title>Don&#39;t prefix JUnit tests with the word test</title>
      <link>/posts/011-dont-prefix-junit-tests-with-the-word-test/</link>
      <pubDate>Thu, 02 Jun 2022 00:00:00 +0000</pubDate>
      <guid>/posts/011-dont-prefix-junit-tests-with-the-word-test/</guid>
      <description><![CDATA[<p>I admit publicly that I like doing code reviews. Code that is submitted for review often contains a lot of implicit information and assumptions of a fellow developer that authored it. Going into their thought process sometimes reveals what we&rsquo;ll see more and more often in software development - a forgotten knowledge about some topic and a way of working that is driven by inertia. &ldquo;Now wait a second Ivan,&rdquo; I hear you say, &ldquo;what in the world does that have to do with prefixing names of my tests with… test?&rdquo;</p>]]></description><enclosure url="/posts/011-dont-prefix-junit-tests-with-the-word-test/cover.png" length="88659" type="image/png" />
    </item>
    
    <item>
      <title>How to install Java 18 (OpenJDK 18) on Windows</title>
      <link>/posts/010-how-to-install-jdk-18-on-windows/</link>
      <pubDate>Thu, 19 May 2022 00:00:00 +0000</pubDate>
      <guid>/posts/010-how-to-install-jdk-18-on-windows/</guid>
      <description><![CDATA[<p>Java 18 is currently the latest version of Java. Even though it isn&rsquo;t a LTS release, it&rsquo;s worth installing it so we can test new features. <a href="/posts/001-how-to-install-jdk-18-on-macos/">In one of the previous articles</a> I have written about how to install it on MacOS. In this article I will show you how to install JDK 18 on Windows, add it to the path and to setup IntelliJ IDEA so you can write Java applications against it.</p>]]></description><enclosure url="/posts/010-how-to-install-jdk-18-on-windows/cover.png" length="103199" type="image/png" />
    </item>
    
    <item>
      <title>New in Java 18: Deprecation of Finalization Mechanism</title>
      <link>/posts/009-new-in-java-18-deprecation-of-finalization-mechanism/</link>
      <pubDate>Thu, 12 May 2022 00:00:00 +0000</pubDate>
      <guid>/posts/009-new-in-java-18-deprecation-of-finalization-mechanism/</guid>
      <description><![CDATA[<p>When I had heard that finalization is (finally!) marked for removal, I was really happy. Some time in the future it will be gone for good from the JDK, which means less code, higher reliability, tighter security and a tad more performance. Marking something for removal from JDK is an extremely rare event. After all, source compatibility is one of the strongest Java&rsquo;s points - you can just grab some source code from version X and it&rsquo;s a really big surprise if it doesn&rsquo;t compile in verson X+N. What is so bad about the finalization that it had to be marked for removal?</p>]]></description><enclosure url="/posts/009-new-in-java-18-deprecation-of-finalization-mechanism/cover.png" length="73754" type="image/png" />
    </item>
    
    <item>
      <title>My 7½ year old learned 4 bash (Linux) commands in one hour</title>
      <link>/posts/008-my-kid-learned-bash-in-one-hour/</link>
      <pubDate>Thu, 05 May 2022 00:00:00 +0000</pubDate>
      <guid>/posts/008-my-kid-learned-bash-in-one-hour/</guid>
      <description><![CDATA[<p>My son is 7½ years old and goes into second grade. We are not native English speakers – as the matter of fact, English is only his third language after Serbian and German. He knows maybe 100 English words, yet he managed to learn and deliberately apply 4 <code>bash</code> commands after just 1 hour of &ldquo;studying&rdquo; with me! I wanted to share this story to demonstrate what kids can effortlessly do if we give them just a bit of nudge, even in this time of flashy apps and games. I will reconstruct our &ldquo;learning&rdquo; session in the form of dialogue.</p>]]></description><enclosure url="/posts/008-my-kid-learned-bash-in-one-hour/cover.png" length="93278" type="image/png" />
    </item>
    
    <item>
      <title>New in Java 18: Code snippets in Javadoc (part 2)</title>
      <link>/posts/007-new-in-java-18-code-snippets-in-javadoc-part-2/</link>
      <pubDate>Thu, 28 Apr 2022 00:00:00 +0000</pubDate>
      <guid>/posts/007-new-in-java-18-code-snippets-in-javadoc-part-2/</guid>
      <description><![CDATA[<p>In the <a href="/posts/003-new-in-java-18-code-snippets-in-javadoc-part-1/">part 1</a> we&rsquo;ve seen how we can use inline snippets in Javadoc and how to control their appearance with regions and highlighting. While such usage should be enough for a lot of use-cases, from time to time we&rsquo;ll need more power, for example to include snippets with block comments. In such cases, external snippets come to the rescue. Let&rsquo;s see how to use them!</p>]]></description><enclosure url="/posts/007-new-in-java-18-code-snippets-in-javadoc-part-2/cover.png" length="81741" type="image/png" />
    </item>
    
    <item>
      <title>New in Java 18: UTF-8 by default</title>
      <link>/posts/006-new-in-java-18-utf8-by-default/</link>
      <pubDate>Thu, 14 Apr 2022 00:00:00 +0000</pubDate>
      <guid>/posts/006-new-in-java-18-utf8-by-default/</guid>
      <description><![CDATA[<p>Ah, good old charsets, who doesn&rsquo;t like them! With so many variations in operating systems, programming languages, human languages, geographical locations etc. what could possibly go wrong when we try to read from or write to files, sockets, screens and other input-output devices? It turns out, quite a lot. There&rsquo;s no shortage of developer horror stories caused by wrong or improper encoding of data. While Java 18 doesn&rsquo;t promise a silver bullet, it makes a step in the right direction because ubiquitous UTF-8 charset will become a default. Let&rsquo;s see what it means to us developers.</p>]]></description><enclosure url="/posts/006-new-in-java-18-utf8-by-default/cover.png" length="77632" type="image/png" />
    </item>
    
    <item>
      <title>New in Java 18: Simple Web Server (part 2)</title>
      <link>/posts/005-new-in-java-18-sws-part-2/</link>
      <pubDate>Thu, 07 Apr 2022 00:00:00 +0000</pubDate>
      <guid>/posts/005-new-in-java-18-sws-part-2/</guid>
      <description><![CDATA[<p>In the <a href="/posts/004-new-in-java-18-sws-part-1/">part 1</a> we&rsquo;ve seen how we can use Simple Web Server (SWS) from the command line during writing or debugging web applications. While such usage should be enough for a lot of use-cases, from time to time we&rsquo;ll need more control over which HTTP methods, headers, MIME types etc. That&rsquo;s why in Java 18 there is a possibility to use SWS programmatically, i.e. to embed it into our applications. For that, we can use some existing classes (i.e. pre Java 18) and also some new ones. Let&rsquo;s see the basic programmatic usage of Simple Web Server (SWS) in action!</p>]]></description><enclosure url="/posts/005-new-in-java-18-sws-part-2/cover.png" length="94649" type="image/png" />
    </item>
    
    <item>
      <title>New in Java 18: Simple Web Server (part 1)</title>
      <link>/posts/004-new-in-java-18-sws-part-1/</link>
      <pubDate>Thu, 31 Mar 2022 00:00:00 +0000</pubDate>
      <guid>/posts/004-new-in-java-18-sws-part-1/</guid>
      <description><![CDATA[<p>A lot of developers work on writing or debugging web applications daily. Sometimes that work involves writing our application&rsquo;s backend and sometimes consuming other web resources, whether they are APIs or &ldquo;normal&rdquo; web pages. Other programming languages recognised the need for having a &ldquo;quick and dirty&rdquo; way of serving resources over HTTP(S) protocol during the development. Good people that developed JDK 18 gave us the opportunity to have that in Java too so we don&rsquo;t have to look at node.js, Python or PHP developers with envy any more when they brag how simple it is to start serving resources in their languages. Let&rsquo;s see the basic usage of Simple Web Server (SWS) in action!</p>]]></description><enclosure url="/posts/004-new-in-java-18-sws-part-1/cover.png" length="94222" type="image/png" />
    </item>
    
    <item>
      <title>New in Java 18: Code snippets in Javadoc (part 1)</title>
      <link>/posts/003-new-in-java-18-code-snippets-in-javadoc-part-1/</link>
      <pubDate>Thu, 24 Mar 2022 00:00:00 +0000</pubDate>
      <guid>/posts/003-new-in-java-18-code-snippets-in-javadoc-part-1/</guid>
      <description><![CDATA[<p>As Java developers our job is not only to write working code but also to document it properly. Since its beginnings Java provided us with the <code>javadoc</code> tool which generates this documentation from the specially formatted <em>documentation comments</em> we wrote in the source code. In these documentation comments we use various <em>tags</em> to document parameters, return values, exceptions thrown etc. It is often the case that we must include a code snippet to show intended usage of our code. Until Java 18 we relied on the <code>@code</code> tag, perhaps in combination with <code>&lt;pre&gt;…&lt;/pre&gt;</code> if we needed multi-line snippets. But now we have a better way and that is by using new <code>@snippet</code> tag. Let&rsquo;s see its basic usage in action!</p>]]></description><enclosure url="/posts/003-new-in-java-18-code-snippets-in-javadoc-part-1/cover.png" length="97989" type="image/png" />
    </item>
    
    <item>
      <title>Use jEnv to manage JDKs</title>
      <link>/posts/002-use-jenv-to-manage-jdks/</link>
      <pubDate>Thu, 17 Mar 2022 00:00:00 +0000</pubDate>
      <guid>/posts/002-use-jenv-to-manage-jdks/</guid>
      <description><![CDATA[<p>As Java developers we often must work with multiple projects at the same time. Even if all projects you develop as a part of your job use the same JDK version, you might still have private projects with a different one, or you simply want to experiment with the new JDK as it&rsquo;s released. In those cases, using jEnv to assign an appropriate JDK to every project is a life saver. Best of all, it&rsquo;s very easy to use and it doesn&rsquo;t require wrangling with the JAVA_HOME environment variable. Let&rsquo;s quickly see it in action!</p>]]></description><enclosure url="/posts/002-use-jenv-to-manage-jdks/cover.png" length="59575" type="image/png" />
    </item>
    
    <item>
      <title>How to install Java 18 (OpenJDK 18) on MacOS</title>
      <link>/posts/001-how-to-install-jdk-18-on-macos/</link>
      <pubDate>Thu, 10 Mar 2022 00:00:00 +0000</pubDate>
      <guid>/posts/001-how-to-install-jdk-18-on-macos/</guid>
      <description><![CDATA[<p>Java 18 is currently the latest version of Java. Even though it isn&rsquo;t a LTS release, it&rsquo;s worth installing it so we can test new features. In this article I will show you how to install JDK 18 on MacOS and to setup IntelliJ IDEA so you can write Java applications against it.</p>]]></description><enclosure url="/posts/001-how-to-install-jdk-18-on-macos/cover.png" length="116529" type="image/png" />
    </item>
    
    <item>
      <title></title>
      <link>/posts/constructor-rules-init/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>/posts/constructor-rules-init/</guid>
      <description><![CDATA[<h1 id="constructor-rules-initialize-fields-only-in-constructor" data-numberify>Constructor rules: initialize fields only in constructor<a class="anchor ms-1" href="#constructor-rules-initialize-fields-only-in-constructor"></a></h1>
<p>I saw this situation in every project in every company I worked for. People initialize some fields in a constructor, some leave as default and some are assigned at the moment of declaration. While such code works it&rsquo;s far from being optimal. It puts unnecessary mental burden on developers because it is unreadable and inconsistent.</p>
<p>Let&rsquo;s see an example class which exposes the problem:</p>]]></description>
    </item>
    
  </channel>
</rss>

