<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mitchell Mutandah</title>
    <description>The latest articles on DEV Community by Mitchell Mutandah (@iammtander).</description>
    <link>https://dev.to/iammtander</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F766802%2Ff995f1c4-5812-4a16-8382-3c38f2208269.jpeg</url>
      <title>DEV Community: Mitchell Mutandah</title>
      <link>https://dev.to/iammtander</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iammtander"/>
    <language>en</language>
    <item>
      <title>Great stuff in there......</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Sat, 21 Feb 2026 11:50:15 +0000</pubDate>
      <link>https://dev.to/iammtander/great-stuff-in-there-3dm4</link>
      <guid>https://dev.to/iammtander/great-stuff-in-there-3dm4</guid>
      <description>&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/respect17/i-taught-my-terminal-to-predict-the-weather-ai-powered-development-environment-optimization-13a" class="crayons-story__hidden-navigation-link"&gt;🤖 I Taught My Terminal to Predict the Weather: AI-Powered Development Environment Optimization&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
      &lt;a href="https://dev.to/respect17/i-taught-my-terminal-to-predict-the-weather-ai-powered-development-environment-optimization-13a" class="crayons-article__context-note crayons-article__context-note__feed"&gt;&lt;p&gt;GitHub Copilot CLI Challenge Submission&lt;/p&gt;

&lt;/a&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/respect17" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F981638%2F1394703d-8965-4066-99cd-a7a85d1f41ec.png" alt="respect17 profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/respect17" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Kudzai Murimi
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Kudzai Murimi
                &lt;a href="/++"&gt;&lt;img alt="Subscriber" class="subscription-icon" src="https://assets.dev.to/assets/subscription-icon-805dfa7ac7dd660f07ed8d654877270825b07a92a03841aa99a1093bd00431b2.png"&gt;&lt;/a&gt;
              
              &lt;div id="story-author-preview-content-3211043" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/respect17" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F981638%2F1394703d-8965-4066-99cd-a7a85d1f41ec.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Kudzai Murimi&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/respect17/i-taught-my-terminal-to-predict-the-weather-ai-powered-development-environment-optimization-13a" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Jan 30&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/respect17/i-taught-my-terminal-to-predict-the-weather-ai-powered-development-environment-optimization-13a" id="article-link-3211043"&gt;
          🤖 I Taught My Terminal to Predict the Weather: AI-Powered Development Environment Optimization
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag crayons-tag--filled  " href="/t/challenge"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;challenge&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/cli"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;cli&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/githubcopilot"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;githubcopilot&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/githubchallenge"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;githubchallenge&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/respect17/i-taught-my-terminal-to-predict-the-weather-ai-powered-development-environment-optimization-13a" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;76&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/respect17/i-taught-my-terminal-to-predict-the-weather-ai-powered-development-environment-optimization-13a#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              23&lt;span class="hidden s:inline"&gt; comments&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            4 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;




</description>
      <category>cli</category>
      <category>challenge</category>
      <category>githubcopilot</category>
      <category>githubchallenge</category>
    </item>
    <item>
      <title>From chaos to calm. How I built a focus app.</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Mon, 14 Apr 2025 15:15:53 +0000</pubDate>
      <link>https://dev.to/iammtander/from-chaos-to-calm-how-i-built-a-focus-app-36ng</link>
      <guid>https://dev.to/iammtander/from-chaos-to-calm-how-i-built-a-focus-app-36ng</guid>
      <description>&lt;p&gt;If you've ever struggled to concentrate in busy environments or found yourself desperately searching for that perfect background sound to drown out distractions, this one's for you. I created this app to solve my own focus problems, and I'm happy to share it with the community. &lt;/p&gt;

&lt;p&gt;Oh, helloooo and welcome 👋. This is how &lt;strong&gt;Lekker Melodies&lt;/strong&gt; (yes, that's the app name 😃) was born from my coffee shop struggles.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9n9y4ih8bxbz7be2vol.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9n9y4ih8bxbz7be2vol.gif" alt="my story" width="220" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Background: The Day My Headphones Broke
&lt;/h2&gt;

&lt;p&gt;Picture this: I'm sitting in my favorite coffee shop locally, laptop open, deadline looming, and my trusty noise-canceling headphones just died. Not battery-dead, but actually broken-dead. The left ear dangled by a wire, and no amount of desperate duct tape could save them.&lt;/p&gt;

&lt;p&gt;And of course, today was the day a birthday party of eight-year-olds decided to take over the table next to me. Their excitement was adorable... but my focus was shattered.&lt;/p&gt;

&lt;p&gt;I tried everything, moving tables (no luck, coffee shop was packed), playing random YouTube background noise (ads kept interrupting), and finally just giving up and heading home. But that commute wasted precious time I didn't have.&lt;/p&gt;

&lt;p&gt;That frustrating afternoon in 2023 planted a seed that would eventually grow into Lekker Melodies.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Coffee Shop Nomad
&lt;/h2&gt;

&lt;p&gt;As a freelance developer, I bounce between coffee shops, co-working spaces, and occasionally park benches when the weather's nice. I've always found something magical about the background buzz of strangers, that perfect level of noise that keeps my brain engaged without pulling my attention.&lt;/p&gt;

&lt;p&gt;But that magic disappears fast when someone starts a loud phone call or a group gets rowdy. Suddenly, the productive background hum becomes a focus-killing distraction.&lt;/p&gt;

&lt;p&gt;I started keeping a list in my notes app of sounds that helped me work. Not music with lyrics (too distracting when working), not pure white noise (too boring after an hour), but that sweet spot in between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rain hitting a tin roof during a writing session in Bali&lt;/li&gt;
&lt;li&gt;The gentle evening bird calls outside my window&lt;/li&gt;
&lt;li&gt;The crackle of a campfire from a weekend trip&lt;/li&gt;
&lt;li&gt;The soft ripple of a stream I recorded during a hike&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These sounds didn't just block noise, they created a bubble of calm that helped my brain settle into work mode, regardless of what chaos surrounded me.&lt;/p&gt;

&lt;h2&gt;
  
  
  South Africa and the "Lekker" Discovery
&lt;/h2&gt;

&lt;p&gt;While working remotely in Cape Town for a month, I kept hearing locals use the word &lt;strong&gt;"lekker"&lt;/strong&gt;. My Airbnb host described a sunset as "lekker." A barista called my coffee order "lekker." A fellow digital nomad said the co-working space was "proper lekker."&lt;/p&gt;

&lt;p&gt;When I finally asked what it meant, the explanation was simple yet perfect: "It means nice, good, pleasant, but better somehow. More satisfying."&lt;/p&gt;

&lt;p&gt;That night, struggling to focus in a busy hostel common room, I put on my DIY recording of evening birds from a nature reserve we'd visited. Another traveler peeked over, curious about what had me so absorbed in my work despite the noise.&lt;/p&gt;

&lt;p&gt;"Those bird sounds are really lekker," I said, testing out my new vocabulary.&lt;/p&gt;

&lt;p&gt;"Exactly," she smiled. "Lekker melodies."&lt;/p&gt;

&lt;p&gt;And just like that, I had a name for what I was building.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building What I Needed
&lt;/h2&gt;

&lt;p&gt;Back home, I got serious about creating a real solution. I wasn't just collecting sounds anymore, I was building the focus tool I'd always wanted but couldn't find.&lt;/p&gt;

&lt;p&gt;I spent weekends recording sounds in parks, by lakes, and even in my kitchen (that campfire crackle took multiple attempts with different types of wood). I reached out to sound creators online who generously shared their work or pointed me to resources.&lt;/p&gt;

&lt;p&gt;Each sound went through the "coffee shop test": I'd sit in the noisiest coffee shop I could find and see if the sound helped me zone in or distracted me further.&lt;/p&gt;

&lt;p&gt;The criteria were simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can I listen to this for 3+ hours without getting annoyed?&lt;/li&gt;
&lt;li&gt;Does it mask unpredictable noises like conversations and coffee grinders?&lt;/li&gt;
&lt;li&gt;Does it fade into the background of my mind after a few minutes?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only the sounds that passed all three tests made it into the app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping It Real Simple
&lt;/h2&gt;

&lt;p&gt;As a developer by training, I fought my instinct to add "cool features" that nobody actually needs. No fancy visualizers, no complicated mixing tools, no login required.&lt;/p&gt;

&lt;p&gt;Just sounds that work, one click away, ready when you need them.&lt;/p&gt;

&lt;p&gt;The whole point of Lekker Melodies is to reduce friction between you and your focus zone. The last thing you need is another app with a learning curve when you're trying to concentrate.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Sound Community
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fra3zraj656c49q3x658k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fra3zraj656c49q3x658k.png" alt="lekermelodies preview" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since launching &lt;a href="https://lekkermelodies.com/" rel="noopener noreferrer"&gt;Lekker Melodies&lt;/a&gt;, I've been blown away by how many people struggle with the same focus issues I had. I've received comments from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A mom who uses the white noise to work while her kids play in the next room&lt;/li&gt;
&lt;li&gt;A college student who relies on the rain sounds to study in his noisy dorm&lt;/li&gt;
&lt;li&gt;A fellow developer who plays the soft piano sounds during late-night coding sessions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The most frequent request? More sounds! Which is why I'm always on the hunt for new, perfect background audio that hits that "lekker" sweet spot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It &amp;amp; Tell Me What You Think
&lt;/h2&gt;

&lt;p&gt;If you're someone who works in noisy places, or just needs help focusing, I'd love for you to give &lt;a href="https://lekkermelodies.com/" rel="noopener noreferrer"&gt;Lekker Melodies&lt;/a&gt; a try. It's completely free, a tool I built for myself that I'm happy to share with others who need it.&lt;/p&gt;

&lt;p&gt;And if you find a sound that helps you focus that's not in the app yet, or have feedback on how to make Lekker Melodies better, drop me a note here. This project grows better with each piece of feedback.&lt;/p&gt;

&lt;p&gt;Until then, I'll be at my usual coffee shop table, campfire crackling through my (new) headphones, typing away in my own little bubble of focus. Come join me there, at least in spirit.&lt;/p&gt;

&lt;p&gt;Peace!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyshjrlo0aqst1gt3iaum.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyshjrlo0aqst1gt3iaum.jpeg" alt="cheers" width="561" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>learning</category>
      <category>webdev</category>
      <category>development</category>
    </item>
    <item>
      <title>Copilot Code Reviewer - What's your experience been like? Worth it?</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Mon, 07 Apr 2025 22:14:05 +0000</pubDate>
      <link>https://dev.to/iammtander/copilot-code-reviewer-whats-your-experience-been-like-worth-it-235d</link>
      <guid>https://dev.to/iammtander/copilot-code-reviewer-whats-your-experience-been-like-worth-it-235d</guid>
      <description>&lt;p&gt;Howdy friends! 👋&lt;/p&gt;

&lt;p&gt;I've been considering adding GitHub Copilot Code Reviewer to my workflow (well, obviously for side projects) but wanted to get some real-world feedback before taking the plunge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For those who've used Copilot Code Reviewer:&lt;/strong&gt; What's your experience been like? I'm particularly interested in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How effective is it at catching bugs or suggesting improvements?&lt;/li&gt;
&lt;li&gt;Does it provide genuinely useful feedback or mostly surface-level comments?&lt;/li&gt;
&lt;li&gt;Any significant time savings in your code review process?&lt;/li&gt;
&lt;li&gt;How does it compare to traditional code review from teammates?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I work mostly with JavaScript/Typescript and Java projects, if that makes any difference in its effectiveness.&lt;br&gt;
If you've tried it and dropped it, I'd love to hear why too!&lt;br&gt;
Thanks in advance for sharing your experiences - the good, the bad, and everything in between!&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>github</category>
      <category>programming</category>
      <category>tooling</category>
    </item>
    <item>
      <title>What I learned from Head First Java: Arrays and ArrayList</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Thu, 03 Apr 2025 11:39:20 +0000</pubDate>
      <link>https://dev.to/iammtander/what-i-learned-fro-head-first-java-arrays-and-arraylist-2pgo</link>
      <guid>https://dev.to/iammtander/what-i-learned-fro-head-first-java-arrays-and-arraylist-2pgo</guid>
      <description>&lt;p&gt;Java offers multiple ways to store collections of data, but two of the most commonly used option (Arrays and ArrayLists) often confuse. In this article, I'll break down the differences between these two data structures in a way that's easy to understand, even if you're new to Java.&lt;/p&gt;

&lt;p&gt;Hello 👋 and welcome to Head First series!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsvotpkspbjr5fo73hsvu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsvotpkspbjr5fo73hsvu.gif" alt="welcome" width="360" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚨Spoiler Alert 😉&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;I'm assuming that you are familiar with arrays and ArrayLists basics. Nothing much, just creating will be good for now. Ready? Lets goooo!&lt;/em&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Definition of terms: The Bookshelf Analogy
&lt;/h2&gt;

&lt;p&gt;I tried to come up with a fair comparison of the scenario using shelves. Think of an &lt;strong&gt;array&lt;/strong&gt; as a bookshelf you buy from IKEA (a common furniture store) with a specific number of slots. Once assembled, you can't add more shelves without buying a completely new unit. An &lt;strong&gt;ArrayList&lt;/strong&gt;, on the other hand, is like a magic bookshelf that automatically expands whenever you need more space.&lt;/p&gt;
&lt;h2&gt;
  
  
  Arrays: The Traditional Fixed-Size Option
&lt;/h2&gt;

&lt;p&gt;Arrays in Java are the original way to store multiple values of the same type. Once created, their size is set in stone.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Creating an array that can hold exactly 5 integers&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;scoresArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// Adding elements at specific positions&lt;/span&gt;
&lt;span class="n"&gt;scoresArray&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;85&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;scoresArray&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;92&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;scoresArray&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;78&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;scoresArray&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;95&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;scoresArray&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;88&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Want to add a 6th score? You can't!&lt;/span&gt;
&lt;span class="c1"&gt;// scoresArray[5] = 90; // This crashes with ArrayIndexOutOfBoundsException&lt;/span&gt;

&lt;span class="c1"&gt;// You can also create and initialize an array in one go&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;daysOfWeek&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"Monday"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Tuesday"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Wednesday"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Thursday"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Friday"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Saturday"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Sunday"&lt;/span&gt;&lt;span class="o"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What happens if you need to store more elements than initially planned? You'll need to create a new, larger array and copy all the elements over, a tedious process that requires manual coding.&lt;/p&gt;

&lt;h2&gt;
  
  
  ArrayList: The Flexible Modern Alternative
&lt;/h2&gt;

&lt;p&gt;Enter ArrayList 🥁, part of Java's Collections Framework. It handles all the resizing hassle behind the scenes so you can focus on your data, not managing storage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// First, you need to import it&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.ArrayList&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Creating an ArrayList of Strings&lt;/span&gt;
&lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;shoppingList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Adding items is easy&lt;/span&gt;
&lt;span class="n"&gt;shoppingList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Milk"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;shoppingList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Bread"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;shoppingList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Eggs"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Forgot something? No problem!&lt;/span&gt;
&lt;span class="n"&gt;shoppingList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Coffee"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;shoppingList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Cheese"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Oops, already have eggs at home&lt;/span&gt;
&lt;span class="n"&gt;shoppingList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;remove&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Eggs"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Need to check if an item is on your list?&lt;/span&gt;
&lt;span class="kt"&gt;boolean&lt;/span&gt; &lt;span class="n"&gt;needsMilk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;shoppingList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Milk"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// returns true&lt;/span&gt;

&lt;span class="c1"&gt;// How many items on the list?&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;itemCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;shoppingList&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// returns 4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The beauty of ArrayList lies in its flexibility and built-in methods that make common operations simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  Side-by-Side Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Array&lt;/th&gt;
&lt;th&gt;ArrayList&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Size&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fixed&lt;/td&gt;
&lt;td&gt;Dynamic (resizable)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Type[] name&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ArrayList&amp;lt;Type&amp;gt; name&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;More efficient&lt;/td&gt;
&lt;td&gt;Slight overhead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Generally faster&lt;/td&gt;
&lt;td&gt;Slightly slower for very large data sets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Element types&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Primitives or objects&lt;/td&gt;
&lt;td&gt;Objects only (uses wrappers for primitives)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Utility methods&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Almost none&lt;/td&gt;
&lt;td&gt;Many (add, remove, contains, etc.)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Type safety&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Checked at compile time&lt;/td&gt;
&lt;td&gt;Generic type checked at compile time&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  When to Use Arrays
&lt;/h2&gt;

&lt;p&gt;Despite the conveniences of ArrayList, arrays still have their place:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Performance-critical applications&lt;/strong&gt;: Arrays have less overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Working with primitives&lt;/strong&gt;: If you need a large collection of int, double, etc. values, arrays avoid the wrapper objects overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-dimensional data&lt;/strong&gt;: While you can create ArrayLists of ArrayLists, multi-dimensional arrays like &lt;code&gt;int[][]&lt;/code&gt; are more straightforward for certain algorithms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When size truly is fixed&lt;/strong&gt;: If you're representing something with an inherently fixed size (like days of the week, chess board squares, etc.).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  When to Use ArrayList
&lt;/h2&gt;

&lt;p&gt;ArrayList shines in many modern use cases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Unknown or changing size&lt;/strong&gt;: When you don't know in advance how many elements you'll need.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frequent insertions/deletions&lt;/strong&gt;: When you need to add or remove elements frequently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Need for built-in methods&lt;/strong&gt;: When you want convenient methods like indexOf(), contains(), or removeIf().&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Working with collections&lt;/strong&gt;: When interfacing with other collection types or using streams.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Real-World Example: Managing Student Records
&lt;/h2&gt;

&lt;p&gt;Let's see both approaches in a practical scenario—tracking students in a class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Array approach - Fixed number of students&lt;/span&gt;
&lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;classRoster&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="o"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// Hope we don't get a 31st student!&lt;/span&gt;

&lt;span class="c1"&gt;// Adding students&lt;/span&gt;
&lt;span class="n"&gt;classRoster&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Alex"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Johnson"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;classRoster&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Taylor"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Smith"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// ... and so on&lt;/span&gt;

&lt;span class="c1"&gt;// ArrayList approach - Flexible roster&lt;/span&gt;
&lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;classRoster&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Adding students&lt;/span&gt;
&lt;span class="n"&gt;classRoster&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Alex"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Johnson"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;span class="n"&gt;classRoster&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Taylor"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Smith"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;// Mid-semester transfer student? No problem&lt;/span&gt;
&lt;span class="n"&gt;classRoster&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Jordan"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Williams"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;

&lt;span class="c1"&gt;// Student drops the class&lt;/span&gt;
&lt;span class="n"&gt;classRoster&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;remove&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Removes Taylor&lt;/span&gt;

&lt;span class="c1"&gt;// Find a specific student&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;alexPosition&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;classRoster&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;classRoster&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;getFirstName&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;equals&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Alex"&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;alexPosition&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Syntax Differences
&lt;/h2&gt;

&lt;p&gt;One thing that often trips up Java beginners is the syntax differences (That's a subjective point of view, hey 😅):&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For arrays:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Declaration and initialization&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// Accessing elements&lt;/span&gt;
&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// Getting length&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Note: length is a property, not a method&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For ArrayLists:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Declaration and initialization&lt;/span&gt;
&lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Accessing elements&lt;/span&gt;
&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Adds to the end&lt;/span&gt;
&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Sets value at index 2&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Getting size&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Note: size() is a method, not a property&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Behind the Scenes
&lt;/h2&gt;

&lt;p&gt;Understanding what happens internally can help you make better choices:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Arrays&lt;/strong&gt; are contiguous blocks of memory with direct access to any element via its index—making lookups extremely fast (O(1) time).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ArrayLists&lt;/strong&gt; store data in a resizable array. When it fills up, ArrayList creates a new, larger array (typically 1.5x the current size) and copies all elements over. This happens automatically but can cause performance hiccups if done frequently with large collections.&lt;/p&gt;

&lt;h2&gt;
  
  
  So to wrap things up.....
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn63gdeh57daxfb3edebu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn63gdeh57daxfb3edebu.gif" alt="wrap things up" width="400" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both arrays and ArrayLists are valuable tools in Java programming. Arrays offer simplicity and raw performance with fixed sizes, while ArrayLists provide flexibility and convenience at a minor performance cost.&lt;/p&gt;

&lt;p&gt;I'd recommend starting with ArrayList in most cases—its flexibility and built-in methods make it more forgiving and productive. As your Java skills advance, you'll develop a sense of when arrays might be the better option for specific scenarios.&lt;/p&gt;

&lt;p&gt;Remember, good programming isn't just about choosing the right tool, but understanding why it's the right tool for the job at hand.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What's your experience with arrays and ArrayLists? Drop a comment below and let me know which you prefer and why!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Until next time......&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5igzdktw18dqjbxrbki.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5igzdktw18dqjbxrbki.jpeg" alt="cheers" width="561" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Just in! Supabase UI library</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Tue, 01 Apr 2025 14:06:13 +0000</pubDate>
      <link>https://dev.to/iammtander/just-in-supabase-ui-library-4hfe</link>
      <guid>https://dev.to/iammtander/just-in-supabase-ui-library-4hfe</guid>
      <description>&lt;p&gt;Hey folks! Just got my hands on some exciting news I had to share with the community. Supabase (you know, that awesome Postgres-based backend we all love?) just launched their official UI Library yesterday, and after playing with it all night, I'm genuinely pumped about what this means for our projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  The TL;DR for busy devs
&lt;/h2&gt;

&lt;p&gt;Supabase now offers ready-to-use React components built on &lt;code&gt;shadcn/ui&lt;/code&gt; that you can drop into practically any React-based project (Next.js, React Router, TanStack Start). Installation is dead simple, works just like installing any shadcn/ui component.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I'm excited (and you should be too)
&lt;/h2&gt;

&lt;p&gt;Let's be honest: how many hours have we all spent building the same authentication flows, file uploaders, and real-time features? Too many. This library tackles exactly those pain points.&lt;/p&gt;

&lt;p&gt;I've already tried implementing the auth components in a side project, and what would have taken me a full evening was done in literally minutes. The authentication block comes with everything: sign-up, sign-in, password reset—all styled, responsive, and ready to rock.&lt;/p&gt;

&lt;h2&gt;
  
  
  The coolest components (so far)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Password-based authentication&lt;/strong&gt;: Complete flows for signup, signin, and password management&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File Upload Dropzone&lt;/strong&gt;: Drag-and-drop file uploads with previews (finally!)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Realtime features&lt;/strong&gt;: This is where things get interesting

&lt;ul&gt;
&lt;li&gt;Cursor sharing (for collaborative editing)&lt;/li&gt;
&lt;li&gt;Avatar stacks showing who's online (like Notion/Figma)&lt;/li&gt;
&lt;li&gt;Realtime chat components (that actually work out of the box!)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;The realtime cursor sharing component is particularly slick. I've been wanting to add collaborative features to my projects but always put it off because... well, it's complicated. Now it's literally a component drop-away.&lt;/p&gt;

&lt;h2&gt;
  
  
  For the AI folks
&lt;/h2&gt;

&lt;p&gt;They've also included LLM rules for AI code editors to help models understand Supabase-specific features like Row Level Security policies and Edge Functions. I haven't tested these yet, but if they help prevent those "wait, that's not how RLS works" moments, I'm all for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Built on good foundations
&lt;/h2&gt;

&lt;p&gt;It makes perfect sense that they built on top of shadcn/ui, it's been JavaScript's top rising star two years running. The copy-and-paste component approach gives you total control over customization, which beats wrestling with opinionated libraries any day.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check the docs!:&lt;/strong&gt; &lt;em&gt;For the full component documentation, installation guides, and all the nitty-gritty details, make sure to visit the official &lt;a href="https://supabase.com/ui/docs/getting-started/introduction" rel="noopener noreferrer"&gt;Supabase UI Library docs&lt;/a&gt;. The documentation is comprehensive and includes plenty of code examples to get you started quickly.&lt;/em&gt; Trust me, it's worth bookmarking!&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyiuyze3506ykkqfb4z5p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyiuyze3506ykkqfb4z5p.png" alt="what's next" width="400" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The team says they're planning to release more components and are taking suggestions. I'm personally hoping for some database visualization components—might have to hop on Discord and suggest it.&lt;/p&gt;

&lt;p&gt;Have you tried it yet? What components would you like to see them add? Drop a comment below, I'm genuinely curious what other devs think about this!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;P.S. If you build something cool with these components, share it in the comments. Always looking for inspiration!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Until next time......&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fac1ebu0vayzeb8q04hdt.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fac1ebu0vayzeb8q04hdt.jpeg" alt="cheers" width="561" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>supabase</category>
      <category>news</category>
    </item>
    <item>
      <title>What I learned from Head First: Understanding == vs .equals() in Java</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Mon, 17 Mar 2025 16:11:55 +0000</pubDate>
      <link>https://dev.to/iammtander/what-i-learned-from-head-first-understanding-vs-equals-in-java-1g3d</link>
      <guid>https://dev.to/iammtander/what-i-learned-from-head-first-understanding-vs-equals-in-java-1g3d</guid>
      <description>&lt;p&gt;Hello friends 👋&lt;br&gt;
Recently, I got confused about when to use &lt;code&gt;==&lt;/code&gt; and &lt;code&gt;.equals()&lt;/code&gt;. After careful analysis and referring to several sources, including YouTube videos, , I decided to put together this quick and friendly guide to clear things up! Don’t worry, I’ll keep it short and sweet.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Spoiler Alert: You might want to brush up on how stack memory works with objects before diving in! src - &lt;a href="https://www.digitalocean.com/community/tutorials/java-heap-space-vs-stack-memory" rel="noopener noreferrer"&gt;https://www.digitalocean.com/community/tutorials/java-heap-space-vs-stack-memory&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Overview: The elephant in the room...
&lt;/h2&gt;

&lt;p&gt;The distinction between == and .equals() is crucial, especially when dealing with object references and value comparisons. I will define the terms below for a better understanding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;== (Reference Comparison)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Used to compare primitive data types (like int, char, double).&lt;/li&gt;
&lt;li&gt;When used with object references, it checks whether two references point to the same memory location (object).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false (different objects in memory)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;.equals() (Content Comparison)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Defined in the Object class and can be overridden in user-defined classes.&lt;/li&gt;
&lt;li&gt;For objects, it is meant to compare the contents (state) of two objects rather than their memory locations.&lt;/li&gt;
&lt;li&gt;By default, Object.equals() behaves like ==, but many classes (like String, Integer) override it to compare values.
Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;equals&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true (same content)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example with Primitives and Wrapper Classes&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true (primitive values are the same)&lt;/span&gt;

&lt;span class="nc"&gt;Integer&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nc"&gt;Integer&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false (different objects)&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;equals&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true (same content)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Special Case: String Pool&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true (same interned String object)&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;equals&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true (same content)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt; "Java" is stored in the String pool, so s1 and s2 reference the same memory location.&lt;/p&gt;

&lt;h2&gt;
  
  
  My blindspot: primitives behaviour
&lt;/h2&gt;

&lt;p&gt;I tried to come up with edge cases having all these fundamentals at hand. My mind was like, what if:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;short&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Notice that we have &lt;code&gt;short&lt;/code&gt; and &lt;code&gt;int&lt;/code&gt; as different primitives. Let me break it down in 3 steps:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Understanding == with Primitives&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The == operator compares values directly when dealing with primitive types.&lt;/li&gt;
&lt;li&gt;Since both a and b are primitive numeric types (int and short), Java will perform an implicit widening conversion before comparing them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Type Promotion in Java&lt;/strong&gt;&lt;br&gt;
When an arithmetic or comparison operation involves different primitive types, Java applies type promotion to ensure compatibility:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;int&lt;/code&gt; is wider than short (since short is 16-bit and int is 32-bit).&lt;/li&gt;
&lt;li&gt;Before performing the == comparison, Java automatically promotes b from short to int.&lt;/li&gt;
&lt;li&gt;After promotion, both a and b become integers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3.Final Comparison&lt;/strong&gt;&lt;br&gt;
After promotion:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// remains int&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// promoted from short to int&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, the comparison:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;System.out.println(a == b);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;will be true, since both are int and have the same value (9), the comparison returns true.&lt;/p&gt;




&lt;p&gt;That's it! Hope it makes sense all the way. Got questions? Drop them in the comments, and let’s discuss!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Until next time.....&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5b496ko5sgkko4wl1j2.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5b496ko5sgkko4wl1j2.jpeg" alt="cheers" width="561" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>java</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>🚨 App Center Shutdown: What’s Your Alternative? 🚨</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Mon, 10 Mar 2025 22:24:40 +0000</pubDate>
      <link>https://dev.to/iammtander/app-center-shutdown-whats-your-alternative-593e</link>
      <guid>https://dev.to/iammtander/app-center-shutdown-whats-your-alternative-593e</guid>
      <description>&lt;p&gt;Howdy friends 👋&lt;/p&gt;

&lt;p&gt;With App Center scheduled for retirement on March 31, have you already settled on a solid alternative for mobile app builds and managed releases? 🤔&lt;/p&gt;

&lt;p&gt;Would love to hear what you're using now and how it compares to App Center—better, worse, or just different? Share your experiences, pros &amp;amp; cons, and any tips for those still looking for a new solution!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(source - &lt;a href="https://learn.microsoft.com/en-us/appcenter/retirement" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/appcenter/retirement&lt;/a&gt;)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>mobile</category>
      <category>discuss</category>
      <category>programming</category>
    </item>
    <item>
      <title>What I learned from Head First: The life of a Java object reference.</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Mon, 03 Mar 2025 14:48:12 +0000</pubDate>
      <link>https://dev.to/iammtander/what-i-learned-from-head-first-the-life-of-a-java-object-reference-3e6k</link>
      <guid>https://dev.to/iammtander/what-i-learned-from-head-first-the-life-of-a-java-object-reference-3e6k</guid>
      <description>&lt;p&gt;Hello and welcome! 🤗 As I continue my journey of learning Java fundamentals with &lt;em&gt;Head First Java&lt;/em&gt;, I came across an interesting section that I believe could be insightful for others. Sharing it here might spark some curiosity and learning. Let's get started!&lt;/p&gt;




&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Have you ever considered what it's like to be a Java object reference? Probably not. But today, let's explore how reference variables work. Think of a reference like a remote control. It can control different objects, sometimes isn't set up yet (&lt;code&gt;null&lt;/code&gt;), and occasionally leads to objects being removed (garbage collection).&lt;/p&gt;

&lt;p&gt;In this piece, I will try to explain Java's object references in a clear way (hopefully 😃). Just useful examples and some moments where things suddenly make sense.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. What Exactly Is an Object Reference?&lt;/strong&gt;&lt;br&gt;
In Java, an object reference is not the actual object. It's similar to a remote control that helps you work with an object stored in memory. Here's an example:&lt;br&gt;
&lt;em&gt;- I will refer to this basic class during the entire session&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;bark&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" says woof!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;  &lt;span class="c1"&gt;// 'd' is a reference to a Dog object&lt;/span&gt;
        &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Buddy"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;bark&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Buddy says woof!&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmpv2duznzbi02nsseik.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmpv2duznzbi02nsseik.png" alt="dog remote" width="430" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, &lt;code&gt;d&lt;/code&gt; is the reference. It doesn't contain the Dog object—it just points to where the object exists in memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Can an Object Reference Change?&lt;/strong&gt;&lt;br&gt;
Yes! A reference can point to a different object of the same type, like a universal remote that can work with different TVs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;dog1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Rex"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;dog2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Luna"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;myDog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dog1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// myDog refers to 'Rex'&lt;/span&gt;
&lt;span class="n"&gt;myDog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dog2&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Now it refers to 'Luna'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqfpwr0n72q12e7fowkli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqfpwr0n72q12e7fowkli.png" alt="reassigning" width="800" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, &lt;code&gt;myDog&lt;/code&gt; first controlled &lt;code&gt;dog1&lt;/code&gt; (Rex), then changed to control &lt;code&gt;dog2&lt;/code&gt; (Luna). However, it cannot refer to a Car object. Java strictly checks types.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;myCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Car&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;myDog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;myCar&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ❌ Compilation Error! A Dog reference can't point to a Car.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. What Happens When a Reference is final?&lt;/strong&gt;&lt;br&gt;
When you mark a reference as final, you can't make it point to another object, but the object it points to can still change:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;myDog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Rocky"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;myDog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Bella"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ❌ Error: Cannot reassign a final reference&lt;/span&gt;

&lt;span class="n"&gt;myDog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Charlie"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ✅ Allowed! The object itself can change&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhlbsddn1zm1e6785cdd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnhlbsddn1zm1e6785cdd.png" alt="final ref" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's like having a remote that can only control one specific TV. You can change the channel (change the object's properties), but you can't use it with a different TV.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. The Dreaded null Reference&lt;/strong&gt;&lt;br&gt;
A reference can exist without pointing to any object. That's called null, and it's an empty state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;myDog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// myDog exists, but points to nothing&lt;/span&gt;
&lt;span class="n"&gt;myDog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;bark&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// ❌ NullPointerException! myDog doesn't control anything&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funr03xwok8noy843ao6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funr03xwok8noy843ao6k.png" alt="null ref" width="800" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is more like having a remote control without a TV. Press any button—nothing happens.&lt;br&gt;
To avoid this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always check if a reference is null before using it.&lt;/li&gt;
&lt;li&gt;Use optional features (like Optional in Java 8+).&lt;/li&gt;
&lt;li&gt;Set up references correctly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. When References Go Away: Garbage Collection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If an object has no references pointing to it, Java's garbage collector frees the memory. This is cutting the last connection to an old device—it gets removed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;dog1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;dog1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Max"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;dog1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Max is now unreachable and eligible for garbage collection&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even more sadly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;dog1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;dog2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="n"&gt;dog1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Bolt"&lt;/span&gt;
&lt;span class="n"&gt;dog2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Fluffy"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;dog1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dog2&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Now Bolt is lost forever (unless another reference held it)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When &lt;code&gt;dog1&lt;/code&gt; was changed to point to &lt;code&gt;dog2'&lt;/code&gt;s object, the original &lt;em&gt;Bolt&lt;/em&gt; object lost its last reference. Java's garbage collector will eventually clear that memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;So... In a nutshell...&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Being an object reference isn't easy. You get changed, left empty, and sometimes abandoned. But understanding how references work is important for mastering Java memory management.&lt;br&gt;
So next time you write &lt;code&gt;Dog myDog = new Dog("Charlie");&lt;/code&gt;, remember—you're not creating a Dog. You're just holding a remote control that points to one.&lt;/p&gt;




&lt;p&gt;Let me know if this is something that brings a few lightbulb moments ✨ 💡. Until next time ..... cheers!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F81tear7s72t5lco2nbze.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F81tear7s72t5lco2nbze.jpeg" alt="cheers" width="561" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>java</category>
      <category>newbie</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What I Learned from Head First Java: Variable Casting</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Fri, 28 Feb 2025 10:41:42 +0000</pubDate>
      <link>https://dev.to/iammtander/what-i-learned-from-head-first-java-variable-casting-1ii7</link>
      <guid>https://dev.to/iammtander/what-i-learned-from-head-first-java-variable-casting-1ii7</guid>
      <description>&lt;p&gt;So recently I was reading this &lt;strong&gt;Head First Java&lt;/strong&gt; book by &lt;em&gt;Sierra, Kathy, Bates, Bert&lt;/em&gt; on variables and decided to share my experience with the community (Good book, by the way). I have used a lot of real world examples and figurative speech to make it absolutely beginner friendly. Here it goes...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6f4azmnix6j4wm4dfa7a.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6f4azmnix6j4wm4dfa7a.gif" alt="follow me" width="200" height="188"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The background
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Wait, What Are We Even Talking About?&lt;/strong&gt;&lt;br&gt;
Before we dive into the deep end, let's get our feet wet with some basics. Ever tried explaining to your non-tech friend what you do all day? Yeah, it gets confusing fast.&lt;br&gt;
&lt;strong&gt;Variables:&lt;/strong&gt; Think of these as labeled containers in your code. Want to store a number? Use a variable. A piece of text? Variable. Your high score? You guessed it—variable. &lt;em&gt;They're just storage spaces with names attached to them.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Primitive Data Types:&lt;/strong&gt; Java has eight of these built-in simple types. They're the atoms of Java—the building blocks that can't be broken down further. We're talking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;byte, short, int, long&lt;/em&gt;&lt;/strong&gt; (integers of increasing size)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;float, double&lt;/em&gt;&lt;/strong&gt; (decimal numbers)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;char&lt;/em&gt;&lt;/strong&gt; (single characters)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;boolean&lt;/em&gt;&lt;/strong&gt; (true/false values)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each has its own size limit. An &lt;code&gt;int&lt;/code&gt; can hold numbers roughly between -2 billion and +2 billion. A byte? Just -128 to 127. Ever wonder why we need so many? It's all about efficiency, why waste memory on a long when a byte will do?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Enough of yapping, get the basics of data types from &lt;a href="https://www.geeksforgeeks.org/data-types-in-java/" rel="noopener noreferrer"&gt;here&lt;/a&gt; - src Geeks for Geeks&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Casting:&lt;/strong&gt; Here's where the fun begins. What happens when you try to put a &lt;code&gt;double&lt;/code&gt; value into an &lt;code&gt;int&lt;/code&gt; variable? Or an int into a byte? That's casting—converting one data type to another. It's like trying to pour water from one container to another of a different shape. Sometimes it fits perfectly, sometimes it spills.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Two Casting Families: Implicit and Explicit
&lt;/h2&gt;

&lt;p&gt;In Java, there are two main ways variables can transform from one type to another:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Implicit Casting: The Automatic Upgrade&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of implicit casting as getting a free upgrade on your flight. You booked economy (smaller data type), but they bump you to business class (larger data type) without you even asking. No extra code needed!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;myNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;biggerNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;myNumber&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Implicit cast - Java does this automatically&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Why does this work?&lt;/strong&gt;&lt;/em&gt; Because Java knows a long has plenty of room to store whatever an int contains. There's zero chance of data loss, so Java says "I got this" and handles the conversion automatically.&lt;br&gt;
Have you ever noticed how you never have to tell Java to convert smaller numbers to bigger containers? That's because Java is playing it safe. It's like the friend who double-checks that you've locked your door.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explicit Casting: The Forced Downgrade&lt;/strong&gt;&lt;br&gt;
Now imagine trying to fit your oversized carry-on into the tiny overhead compartment. You'll need to remove some items (data) or risk breaking something. That's explicit casting - you're telling Java, "I know this might cause problems, but do it anyway."&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;decimalNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;100.25&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;wholeNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;decimalNumber&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Explicit cast - we must use (int)&lt;/span&gt;
&lt;span class="c1"&gt;// wholeNumber is now 100 - we lost the .25!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The (int) part is us telling Java: "I'm aware I might lose data here, but proceed anyway."&lt;br&gt;
Ever tried to stuff 10 pounds of potatoes into a 5-pound bag? That's explicit casting in a nutshell. Something's gotta give.&lt;/p&gt;
&lt;h2&gt;
  
  
  Widening vs Narrowing: Size Matters
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Implicit Widening: Room to Grow&lt;/strong&gt;&lt;br&gt;
Implicit widening is like moving from a studio apartment to a mansion. Everything fits with room to spare!&lt;br&gt;
The widening path for primitives looks like:&lt;br&gt;
&lt;code&gt;byte → short → int → long → float → double&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;byte&lt;/span&gt; &lt;span class="n"&gt;tinyNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;short&lt;/span&gt; &lt;span class="n"&gt;smallNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tinyNumber&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// Implicit widening&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;mediumNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;smallNumber&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// More implicit widening&lt;/span&gt;
&lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;bigNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mediumNumber&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// You get the idea!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each step gives your data more room. Java handles these conversions automatically because there's no risk.&lt;br&gt;
Have you ever wondered why you can put an &lt;code&gt;int&lt;/code&gt; into a &lt;code&gt;float&lt;/code&gt; even though both are 32 bits? It's because they store data differently—floats can represent a wider range but with less precision. Tradeoffs, always tradeoffs!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explicit Narrowing: Downsizing with Caution&lt;/strong&gt;&lt;br&gt;
Explicit narrowing is like trying to pack your three-bedroom apartment into a studio. Something's gotta give!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;bigDecimal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;123456.789&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;mediumInt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;bigDecimal&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="c1"&gt;// Explicit narrowing - lost the decimals&lt;/span&gt;
&lt;span class="kt"&gt;short&lt;/span&gt; &lt;span class="n"&gt;smallShort&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;short&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;mediumInt&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// More narrowing - might lose data if value &amp;gt; 32767&lt;/span&gt;
&lt;span class="kt"&gt;byte&lt;/span&gt; &lt;span class="n"&gt;tinyByte&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;smallShort&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;    &lt;span class="c1"&gt;// Even more narrowing - might lose data if value &amp;gt; 127&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each step requires the cast operator because you're risking data loss or overflow.&lt;br&gt;
Ever accidentally deleted important files to free up disk space? That's what can happen with narrowing conversions—you might lose data you actually needed!&lt;/p&gt;
&lt;h2&gt;
  
  
  Real-world Examples I Found Helpful
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Implicit Cast Example: The Automatic Promotion&lt;/strong&gt;&lt;br&gt;
Imagine you're calculating the average score of a game:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;score1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;85&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;score2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;92&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;average&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;score2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;2.0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Implicit cast happens here&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Java automatically converts the &lt;code&gt;int&lt;/code&gt; values to &lt;code&gt;double&lt;/code&gt; when they interact with 2.0 (a double). No casting syntax needed!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explicit Cast Example: The Currency Converter&lt;/strong&gt;&lt;br&gt;
Let's say you're building a currency converter that needs to ditch the cents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;dollarsWithCents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;125.99&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;wholeDollars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;dollarsWithCents&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Explicitly cast to int, losing cents&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"You have "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;wholeDollars&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" whole dollars"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Prints "You have 125 whole dollars"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The "Gotchas" I Discovered&lt;/strong&gt;&lt;br&gt;
The biggest surprise for me was how seemingly innocent operations can cause overflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;byte&lt;/span&gt; &lt;span class="n"&gt;smallByte&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;127&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Max value for byte&lt;/span&gt;
&lt;span class="n"&gt;smallByte&lt;/span&gt;&lt;span class="o"&gt;++;&lt;/span&gt; &lt;span class="c1"&gt;// Surprise! Now smallByte equals -128&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This happens because bytes &lt;strong&gt;wrap around&lt;/strong&gt; when they overflow, like an odometer in a very old car.&lt;/p&gt;

&lt;p&gt;Another surprise was learning that &lt;code&gt;char&lt;/code&gt; and &lt;code&gt;byte/short&lt;/code&gt; don't implicitly convert to each other, despite all being smaller than &lt;code&gt;int&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="n"&gt;letter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sc"&gt;'A'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;byte&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;letter&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ❌Compilation error!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;You need an explicit cast:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;byte&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="n"&gt;letter&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Works, but be careful&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Final Thoughts 🤔
&lt;/h2&gt;

&lt;p&gt;Understanding Java's casting system is like learning the rules of the road - once you know them, you avoid accidents. Start with the safe implicit casts when possible, and when you need to use explicit casts, remember you're telling Java, "I accept the consequences!"&lt;/p&gt;

&lt;p&gt;Do you have any casting horror stories? Ever lost data or gotten weird results from a cast gone wrong? Drop them in the comments—misery loves company, especially among programmers!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Until next time, Happy Casting ✨&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5b1y1odqcdprrtz1f3dj.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5b1y1odqcdprrtz1f3dj.jpeg" alt="cheers" width="561" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>java</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>React Native 0.77 Just Landed: Styling Superpowers &amp; More!</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Wed, 22 Jan 2025 10:55:19 +0000</pubDate>
      <link>https://dev.to/iammtander/react-native-077-just-landed-styling-superpowers-more-3350</link>
      <guid>https://dev.to/iammtander/react-native-077-just-landed-styling-superpowers-more-3350</guid>
      <description>&lt;p&gt;Howdy friends 👋! Guess what just landed? &lt;strong&gt;React Native 0.77&lt;/strong&gt; is here, and it's like getting a surprise package full of goodies! If you've been waiting for better styling controls or worrying about Android compatibility, this update has your back.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhcj53mi3goyje0wkfpq5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhcj53mi3goyje0wkfpq5.gif" alt="Lets get started" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've dug through the release notes, played with the new features, and I'm excited to share what's coming to your development toolkit. &lt;em&gt;Spoiler alert:&lt;/em&gt; there's some really cool stuff in here!&lt;/p&gt;

&lt;p&gt;Let's unpack this release and see what makes it special. Trust me, the new &lt;code&gt;mixBlendMode&lt;/code&gt; alone is worth getting excited about - who doesn't love playing with color blending? &lt;/p&gt;

&lt;h2&gt;
  
  
  What's New in This Release
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;🎨 Better Styling Options&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The styling system got some great upgrades:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;display: contents&lt;/code&gt; lets you hide wrapper components while keeping their children visible.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;boxSizing&lt;/code&gt; gives developers more control over width and height calculations.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mixBlendMode&lt;/code&gt; adds new color blending options.&lt;/li&gt;
&lt;li&gt;New outline properties for highlighting elements without size changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;📱 Android Updates&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Android side received important updates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Full support for Android 15's edge-to-edge display&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compatible with Android's new 16KB page size for future devices&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Updated Kotlin support to version 2.0.21&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🛠 Template and CLI Changes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Several tooling changes are coming:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;iOS templates now use Swift by default (Objective-C remains supported)&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;react-native init&lt;/code&gt; command is being replaced - developers should use &lt;code&gt;npx create-expo-app&lt;/code&gt; or &lt;code&gt;npx @react-native-community/cli init&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Metro no longer includes keyboard shortcuts for running on iOS/Android&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💻 Important Changes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Developers should note:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Console logs now go through React Native DevTools instead of Metro&lt;/li&gt;
&lt;li&gt;iOS apps need to add &lt;code&gt;RCTAppDependencyProvider&lt;/code&gt; for third-party dependencies&lt;/li&gt;
&lt;li&gt;Some internal APIs have been removed or changed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Getting Started&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Creating a new project is simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npx&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;native&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;community&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;cli&lt;/span&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;latest&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt; &lt;span class="nx"&gt;MyProject&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;version&lt;/span&gt; &lt;span class="nx"&gt;latest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;That's a wrap on React Native 0.77! Whether you're building your first app or your fiftieth, these new features will make your development journey smoother and more fun. I'd love to hear what you think about these updates - especially if you try out those new styling features! Drop a comment below or share what you're building with these new tools.&lt;/p&gt;

&lt;p&gt;Read full React Native blog post here: &lt;a href="https://reactnative.dev/blog/2025/01/21/version-0.77" rel="noopener noreferrer"&gt;https://reactnative.dev/blog/2025/01/21/version-0.77&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Until next time&lt;/em&gt; ✨&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;P.S.&lt;/strong&gt; : Don't forget to backup your project before upgrading - it's always better to be safe than sorry! 😉&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5d0lpcjfg31706u6xvbx.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5d0lpcjfg31706u6xvbx.jpeg" alt="cheers" width="561" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>reactnative</category>
      <category>news</category>
      <category>programming</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Sun, 29 Dec 2024 17:24:59 +0000</pubDate>
      <link>https://dev.to/iammtander/-3dga</link>
      <guid>https://dev.to/iammtander/-3dga</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/iammtander" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F766802%2Ff995f1c4-5812-4a16-8382-3c38f2208269.jpeg" alt="iammtander"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/iammtander/custom-fonts-in-react-native-pro-tip-4693" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Custom Fonts In React Native: Pro Tip!&lt;/h2&gt;
      &lt;h3&gt;Mitchell Mutandah ・ May 7 '24&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#reactnative&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>reactnative</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Has Broadcom Damaged VMware's Reputation?</title>
      <dc:creator>Mitchell Mutandah</dc:creator>
      <pubDate>Tue, 29 Oct 2024 18:35:18 +0000</pubDate>
      <link>https://dev.to/iammtander/has-broadcom-damaged-vmwares-reputation-3l7o</link>
      <guid>https://dev.to/iammtander/has-broadcom-damaged-vmwares-reputation-3l7o</guid>
      <description>&lt;p&gt;Since &lt;a href="https://investors.broadcom.com/news-releases/news-release-details/broadcom-completes-acquisition-vmware" rel="noopener noreferrer"&gt;Broadcom acquired VMware&lt;/a&gt;, it seems that more and more businesses are facing a dilemma: stick with VMware or start hunting for alternatives. The top complaint? Skyrocketing costs. While VMware is still one of the strongest virtualization solutions out there, many companies are bracing themselves for steep renewal fees, and some are already planning their exit strategies.&lt;/p&gt;

&lt;p&gt;So, if you’re dealing with the VMware cost dilemma, you might be wondering: what alternatives offer similar performance without the hefty price tag? Here’s a look at some popular contenders that could be worth your consideration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Microsoft Hyper-V:&lt;/strong&gt; A well-established option, particularly appealing if you're already invested in Microsoft ecosystems. Hyper-V is known for solid performance, and for those using Windows Server, it's a logical choice that can save on integration costs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;KVM (Kernel-based Virtual Machine):&lt;/strong&gt; Built directly into Linux, KVM is a cost-effective option with good scalability. It’s an open-source solution, so it can be customized to fit specific needs, though it may require a bit more technical setup and knowledge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Proxmox:&lt;/strong&gt; You might have only recently come across Proxmox, but it’s a solid open-source solution that combines KVM with container-based virtualization. Proxmox is highly rated for ease of use and is a popular choice for those who want to reduce costs while maintaining powerful management capabilities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Nutanix:&lt;/strong&gt; Known for its hyper-converged infrastructure, Nutanix has been gaining popularity as an enterprise-grade alternative to VMware. It focuses on simplicity and agility, allowing organizations to consolidate their IT infrastructure and, in many cases, cut down on costs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If Broadcom's takeover has you on the fence, you’re not alone. Which alternatives are you considering, or have you already started exploring other options? With such a shift in VMware’s pricing, now could be the perfect time to reevaluate your virtualization strategy and find a solution that better fits your budget and needs.&lt;/p&gt;

&lt;p&gt;LMK what's your take on this.&lt;br&gt;
&lt;em&gt;Until next time.....&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3sn4zhc6bo2iyesemos5.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3sn4zhc6bo2iyesemos5.jpeg" alt="cheers" width="561" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>cloudcomputing</category>
      <category>cloudskills</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
