<?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: Gowtham</title>
    <description>The latest articles on DEV Community by Gowtham (@gowtham_s).</description>
    <link>https://dev.to/gowtham_s</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4094453%2Fb8b402eb-55be-4976-9ec9-292b2efed101.jpg</url>
      <title>DEV Community: Gowtham</title>
      <link>https://dev.to/gowtham_s</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gowtham_s"/>
    <language>en</language>
    <item>
      <title>Python - Scenario based problem solving programs</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Wed, 02 Dec 2026 15:25:40 +0000</pubDate>
      <link>https://dev.to/gowtham_s/python-scenario-based-problem-solving-programs-3i2d</link>
      <guid>https://dev.to/gowtham_s/python-scenario-based-problem-solving-programs-3i2d</guid>
      <description>&lt;h2&gt;
  
  
  1) Chocolate Wrapper Problem
&lt;/h2&gt;

&lt;p&gt;You have Rs. 100 /- One chocolate costs Rs. 5.  Every time you buy a chocolate, you get one wrapper.  You can exchange 3 wrappers for 1 additional chocolate.  What is the maximum number of chocolates you can have with Rs. 100?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;i) Problem solving using pen and paper&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbmhxhv26b4maxjmd0q7s.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbmhxhv26b4maxjmd0q7s.jpeg" alt=" " width="800" height="648"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ii) Code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;money = 100
chocolate_cost = 5
wrapper_exchange = 3

#Buy chocolates initially
chocolates = money // chocolate_cost

#Initially, every chocolate gives one wrapper
wrappers = chocolates

total_chocolates = chocolates

#Exchange wrappers for additional chocolates
while wrappers &amp;gt;= wrapper_exchange:
    new_chocolates = wrappers // wrapper_exchange

    total_chocolates += new_chocolates

    #Calculate remaining wrappers
    wrappers = (wrappers % wrapper_exchange) + new_chocolates

print("Total Chocolates:", total_chocolates)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Total Chocolates: 29&lt;/p&gt;

&lt;h2&gt;
  
  
  2) Chapathi Story
&lt;/h2&gt;

&lt;p&gt;There is one person called Viyan.  He is a Software Engineer.  He employs a maid for cooking. One day, the maid prepared n number of chapathis and kept in a hot box. Viyan ate those chapathis and the count is as follows: &lt;br&gt;
    * For Morning breakfast, he completed 1/3 number of chapathis in the hot box. &lt;br&gt;
    * For Lunch, He had 1/3 of what was there in the hot box. &lt;br&gt;
    * For Dinner, again he took and ate 1/3 number of chapathis present in the box.&lt;br&gt;&lt;br&gt;
The next day morning, When the maid checked the number of chapathis remaining, it was 8.  What was the number of chapathis, She made - in total?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;i) Problem solving using pen and paper&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9bh6y4jby2hjfsq9d549.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9bh6y4jby2hjfsq9d549.jpeg" alt=" " width="800" height="654"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ii) Code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;remaining = 8
n = 1

while True:
    chapathis = n

    # Morning breakfast
    chapathis = chapathis - (chapathis // 3)

    # Lunch
    chapathis = chapathis - (chapathis // 3)

    # Dinner
    chapathis = chapathis - (chapathis // 3)

    if chapathis == remaining:
        print("Total Chapathis:", n)
        break

    n += 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Total Chapathis: 27&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>learning</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Java - Inheritance</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Tue, 01 Dec 2026 17:26:52 +0000</pubDate>
      <link>https://dev.to/gowtham_s/java-inheritance-225b</link>
      <guid>https://dev.to/gowtham_s/java-inheritance-225b</guid>
      <description>&lt;h2&gt;
  
  
  1. Inheritance in Java
&lt;/h2&gt;

&lt;p&gt;Inheritance is an OOP concept that allows one class to acquire the properties and methods of another class.&lt;/p&gt;

&lt;p&gt;It helps us reuse existing code instead of writing the same code again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example from real life:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Consider a parent and a child. A child may inherit certain characteristics from their parents.&lt;/p&gt;

&lt;p&gt;Similarly, in Java, a child class can inherit accessible fields and methods from a parent class.&lt;/p&gt;

&lt;h3&gt;
  
  
  Important Terminology
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parent Class:&lt;/strong&gt; The class whose properties and methods are inherited. It is also called the superclass.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Child Class:&lt;/strong&gt; The class that inherits from another class. It is also called the subclass.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;extends:&lt;/strong&gt; The keyword used to inherit a class in Java.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Example of Inheritance
&lt;/h2&gt;

&lt;p&gt;Let's create a parent class called &lt;code&gt;Animal&lt;/code&gt; and a child class called &lt;code&gt;Dog&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="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Animal is eating"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&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="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Dog is barking"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&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="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;d1&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="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="n"&gt;d1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;d1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Output
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Animal is eating
Dog is barking
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Explanation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Animal&lt;/code&gt; is the parent class.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Dog&lt;/code&gt; is the child class.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;extends&lt;/code&gt; is used to inherit the &lt;code&gt;Animal&lt;/code&gt; class.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;eat()&lt;/code&gt; is inherited from the parent class.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bark()&lt;/code&gt; belongs to the child class.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here, the &lt;code&gt;Dog&lt;/code&gt; object can access both &lt;code&gt;eat()&lt;/code&gt; and &lt;code&gt;bark()&lt;/code&gt; methods.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Types of Inheritance in Java
&lt;/h2&gt;

&lt;p&gt;Java supports different types of class inheritance.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Single Inheritance
&lt;/h3&gt;

&lt;p&gt;Single inheritance means one child class inherits from one parent class.&lt;/p&gt;

&lt;p&gt;&amp;lt;pre&amp;gt;     Animal        |       Dog &amp;lt;/pre&amp;gt;&lt;/p&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="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Eating..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&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="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Barking..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;Dog&lt;/code&gt; inherits from &lt;code&gt;Animal&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Multilevel Inheritance
&lt;/h3&gt;

&lt;p&gt;Multilevel inheritance means a class inherits from another child class, forming a chain.&lt;/p&gt;

&lt;p&gt;&amp;lt;pre&amp;gt;     Animal        |       Dog        |     Puppy &amp;lt;/pre&amp;gt;&lt;/p&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="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Eating..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&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="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Barking..."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Puppy&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;weep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Puppy is weeping"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&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="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Puppy&lt;/span&gt; &lt;span class="n"&gt;p1&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;Puppy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="n"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;p1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;weep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Eating...
Barking...
Puppy is weeping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;Puppy&lt;/code&gt; inherits methods from both &lt;code&gt;Dog&lt;/code&gt; and &lt;code&gt;Animal&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Hierarchical Inheritance
&lt;/h3&gt;

&lt;p&gt;Hierarchical inheritance means multiple child classes inherit from the same parent class.&lt;/p&gt;

&lt;p&gt;&amp;lt;pre&amp;gt;        Animal        /    \      Dog    Cat &amp;lt;/pre&amp;gt;&lt;/p&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="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Animal is eating"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&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="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Dog is barking"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cat&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;meow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Cat is meowing"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&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="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;d1&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="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;d1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;d1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="nc"&gt;Cat&lt;/span&gt; &lt;span class="n"&gt;c1&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;Cat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;c1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;c1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;meow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Animal is eating
Dog is barking
Animal is eating
Cat is meowing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, both &lt;code&gt;Dog&lt;/code&gt; and &lt;code&gt;Cat&lt;/code&gt; inherit from the &lt;code&gt;Animal&lt;/code&gt; class.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Multiple Inheritance
&lt;/h3&gt;

&lt;p&gt;Multiple inheritance means one child class inherits from more than one parent class.&lt;/p&gt;

&lt;p&gt;Java does not support multiple inheritance through classes because it can create ambiguity when parent classes contain methods with the same signature.&lt;/p&gt;

&lt;p&gt;However, Java supports multiple inheritance of type through interfaces.&lt;/p&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="k"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;Father&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;showFather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;Mother&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;showMother&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Child&lt;/span&gt; &lt;span class="k"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;Father&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Mother&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;showFather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Father's properties"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;showMother&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Mother's properties"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&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="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="nc"&gt;Child&lt;/span&gt; &lt;span class="n"&gt;c1&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;Child&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="n"&gt;c1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;showFather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;c1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;showMother&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Father's properties
Mother's properties
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the &lt;code&gt;Child&lt;/code&gt; class implements two interfaces: &lt;code&gt;Father&lt;/code&gt; and &lt;code&gt;Mother&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Important Keywords Used in Inheritance
&lt;/h2&gt;

&lt;p&gt;Java provides some important keywords related to inheritance.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. extends
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;extends&lt;/code&gt; keyword is used when one class inherits another 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="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. super
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;super&lt;/code&gt; keyword is used to refer to the immediate parent class.&lt;/p&gt;

&lt;p&gt;It can be used to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access parent class variables.&lt;/li&gt;
&lt;li&gt;Call parent class methods.&lt;/li&gt;
&lt;li&gt;Call parent class constructors using &lt;code&gt;super()&lt;/code&gt;.&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="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Animal is eating"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Dog is eating"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output when &lt;code&gt;eat()&lt;/code&gt; is called:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Animal is eating
Dog is eating
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;super.eat()&lt;/code&gt; calls the parent class method.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Advantages of Inheritance
&lt;/h2&gt;

&lt;p&gt;Inheritance provides several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code Reusability:&lt;/strong&gt; Reuse existing code from parent classes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Less Code Duplication:&lt;/strong&gt; Avoid writing the same methods repeatedly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easy Maintenance:&lt;/strong&gt; Changes to inherited functionality can be made in the parent class.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extensibility:&lt;/strong&gt; Add new features in child classes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supports Polymorphism:&lt;/strong&gt; Inheritance allows method overriding and runtime polymorphism.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>learning</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Python - for &amp; while Loops</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Mon, 16 Nov 2026 16:13:49 +0000</pubDate>
      <link>https://dev.to/gowtham_s/python-for-while-loops-12j</link>
      <guid>https://dev.to/gowtham_s/python-for-while-loops-12j</guid>
      <description>&lt;h2&gt;
  
  
  for Loop
&lt;/h2&gt;

&lt;p&gt;For loops is used to iterate over a sequence such as a list, tuple, string or range. It executes a block of code once for each item in the sequence.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;n = 4&lt;br&gt;
for i in range(0, n):&lt;br&gt;
    print(i)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;0&lt;br&gt;
1&lt;br&gt;
2&lt;br&gt;
3&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;n = 4 stores the ending value for the loop.&lt;/li&gt;
&lt;li&gt;range(0, n) generates numbers from 0 to 3.&lt;/li&gt;
&lt;li&gt;for i in range(0, n): iterates through each number in the range.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A for loop can also iterate through sequence elements using their index values with the help of range() and len().&lt;/p&gt;

&lt;p&gt;a = ["need", "for", "speed"]&lt;br&gt;
for idx in range(len(a)):&lt;br&gt;
    print(a[idx])&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;need&lt;br&gt;
for&lt;br&gt;
speed&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;len(a) returns the total number of elements in the list.&lt;/li&gt;
&lt;li&gt;range(len(a)) generates index values from 0 to 2.&lt;/li&gt;
&lt;li&gt;a[idx] accesses list elements using their index.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  while Loop
&lt;/h2&gt;

&lt;p&gt;While loop repeatedly executes a block of code as long as the given condition remains true. When the condition becomes false, the line immediately after the loop in the program is executed.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cnt = 0&lt;br&gt;
while (cnt &amp;lt; 3):&lt;br&gt;
    cnt = cnt + 1&lt;br&gt;
    print("Hello Gowtham")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hello Gowtham&lt;br&gt;
Hello Gowtham&lt;br&gt;
Hello Gowtham&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cnt = 0 initializes the counter variable.&lt;/li&gt;
&lt;li&gt;while (cnt &amp;lt; 3): runs the loop while the condition is true.&lt;/li&gt;
&lt;li&gt;cnt = cnt + 1 increases the counter value by 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Infinite While Loop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An infinite while loop runs continuously because its condition always remains true.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;while (True):&lt;br&gt;
    print("Hello Gowtham")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;while(True): creates a loop with a condition that is always true.&lt;/li&gt;
&lt;li&gt;print("Hello Gowtham") keeps executing repeatedly inside the loop.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>learning</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Java - this &amp; final keywords</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Mon, 16 Nov 2026 06:56:49 +0000</pubDate>
      <link>https://dev.to/gowtham_s/java-this-final-keywords-4127</link>
      <guid>https://dev.to/gowtham_s/java-this-final-keywords-4127</guid>
      <description>&lt;h2&gt;
  
  
  this Keyword in Java
&lt;/h2&gt;

&lt;p&gt;The this keyword in Java is a reference variable that refers to the current object of a class. It is commonly used to distinguish instance variables from local variables when they have the same name.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Refers to the current class object.&lt;/li&gt;
&lt;li&gt;Used to access current class instance variables and methods.&lt;/li&gt;
&lt;li&gt;Used to invoke another constructor of the same class using this().&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;`class Student {&lt;br&gt;
    String name;&lt;br&gt;
    int age;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Student(String name, int age) {
    this.name = name;
    this.age = age;
}

void display() {
    System.out.println(this.name);
    System.out.println(this.age);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;code&gt;public class Main {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        Student s1 = new Student("Gowtham", 20);&lt;br&gt;
        s1.display();&lt;br&gt;
    }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Gowtham&lt;br&gt;
20&lt;/p&gt;

&lt;p&gt;Explanation&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;this.name refers to the instance variable.&lt;/li&gt;
&lt;li&gt;name refers to the constructor parameter.&lt;/li&gt;
&lt;li&gt;this.age refers to the instance variable.&lt;/li&gt;
&lt;li&gt;age refers to the constructor parameter.&lt;/li&gt;
&lt;li&gt;The this keyword helps us avoid confusion when variable names are the same.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Common Uses of this Keyword&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Referring to current class instance variables.&lt;/li&gt;
&lt;li&gt;Calling another constructor using this().&lt;/li&gt;
&lt;li&gt;Calling a method of the current object.&lt;/li&gt;
&lt;li&gt;Passing the current object as an argument.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  final Keyword in Java
&lt;/h2&gt;

&lt;p&gt;In Java, the final keyword is used to restrict changes and make code more secure and predictable. It can be applied to variables, methods, and classes to prevent modification, overriding, or inheritance. This helps in creating constant values, stable methods, and immutable classes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Final Variable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A final variable cannot be reassigned after it has been initialized.&lt;/p&gt;

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

&lt;p&gt;`public class Main {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        final int age = 20;&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;20&lt;/p&gt;

&lt;p&gt;Here, age is a final variable, so we cannot assign another value to it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Final Method&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A final method cannot be overridden by a subclass.&lt;/p&gt;

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

&lt;p&gt;`class Parent {&lt;br&gt;
    final void display() {&lt;br&gt;
        System.out.println("This is a final method");&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;class Child extends Parent {&lt;br&gt;
    // Cannot override display()&lt;br&gt;
}`&lt;/p&gt;

&lt;p&gt;&lt;code&gt;public class Main {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        Child obj = new Child();&lt;br&gt;
        obj.display();&lt;br&gt;
    }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;This is a final method&lt;/p&gt;

&lt;p&gt;Here, the display() method is declared as final, so the child class cannot override it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Final Class&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A final class cannot be extended by another class.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;final class Student {&lt;br&gt;
    void display() {&lt;br&gt;
        System.out.println("Hello Java!");&lt;br&gt;
    }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;public class Main {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        Student s1 = new Student();&lt;br&gt;
        s1.display();&lt;br&gt;
    }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Hello Java!&lt;/p&gt;

&lt;p&gt;Here, Student is a final class, so another class cannot inherit from it.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>learning</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Python - Return Statement, Pure &amp; Impure Functions</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Sat, 14 Nov 2026 17:53:58 +0000</pubDate>
      <link>https://dev.to/gowtham_s/python-return-statement-pure-impure-functions-d6n</link>
      <guid>https://dev.to/gowtham_s/python-return-statement-pure-impure-functions-d6n</guid>
      <description>&lt;h2&gt;
  
  
  Return Statement
&lt;/h2&gt;

&lt;p&gt;The return statement is used inside a function to send a value back to the place where the function was called. Once return is executed, the function stops running, and any code written after it is ignored. If no value is returned, Python automatically returns None.&lt;/p&gt;

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

&lt;p&gt;`def add(a, b):&lt;br&gt;
    return a + b&lt;/p&gt;

&lt;p&gt;result = add(10, 20)&lt;br&gt;
print(result)`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;30&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;def is used to define a function.&lt;/li&gt;
&lt;li&gt;add() is the function name.&lt;/li&gt;
&lt;li&gt;a and b are parameters.&lt;/li&gt;
&lt;li&gt;return a + b sends the sum back.&lt;/li&gt;
&lt;li&gt;result stores the returned value.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pure Function:
&lt;/h2&gt;

&lt;p&gt;A pure function is a function that always returns the same output when given the same input, and it does not have any side effects. A side effect is any modification that a function makes to the state of the system or its environment outside of its scope. A pure function is deterministic, meaning that its output is entirely determined by its input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is an example of a pure function:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;`function add(a, b) {&lt;br&gt;
      return a + b;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;console.log(add(3, 4));`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
7&lt;/p&gt;

&lt;p&gt;This function takes two numbers as inputs and returns the sum of them. It is a pure function because it doesn't modify any external state and always returns the same output for the same input.&lt;/p&gt;

&lt;h2&gt;
  
  
  Impure Function:
&lt;/h2&gt;

&lt;p&gt;An impure function is a function that has side effects or does not always return the same output when given the same input. Side effects can include modifying a global variable, changing the state of an object, or making a network request.&lt;/p&gt;

&lt;p&gt;Impure functions are harder to reason about and test because they have hidden dependencies and can produce different outputs for the same input. They are also less flexible and reusable because their behavior can be affected by external factors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example of impure functions:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Functions that modify a global variable&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let oldValue = 7;&lt;br&gt;
​&lt;br&gt;
function add(newValue) {&lt;br&gt;
      return oldValue += newValue;&lt;br&gt;
}&lt;br&gt;
​&lt;br&gt;
console.log(add(5));&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;12&lt;/p&gt;

&lt;p&gt;This function increments the global variable oldValue, which is outside of its scope. As a result, the oldValue variable is modified, and the function has a side effect.&lt;/p&gt;

</description>
      <category>python</category>
      <category>learning</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Java - Encapsulation</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Sat, 14 Nov 2026 14:24:12 +0000</pubDate>
      <link>https://dev.to/gowtham_s/java-encapsulation-5b8p</link>
      <guid>https://dev.to/gowtham_s/java-encapsulation-5b8p</guid>
      <description>&lt;h2&gt;
  
  
  Encapsulation
&lt;/h2&gt;

&lt;p&gt;Encapsulation in Java is an object-oriented programming concept that bundles data and the methods that operate on that data into a single unit, such as a class. It also helps control access to the object's internal state by restricting direct access and providing controlled ways to read or modify it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Usually uses private fields to restrict direct access.&lt;/li&gt;
&lt;li&gt;Provides controlled access through methods such as getters and setters when required.&lt;/li&gt;
&lt;li&gt;Allows validation and other rules to be applied before changing data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How Encapsulation is Achieved in Java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Encapsulation is commonly implemented by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Declaring fields as private.&lt;/li&gt;
&lt;li&gt;Providing public or appropriately accessible methods to read or modify the fields.&lt;/li&gt;
&lt;li&gt;Adding validation inside methods when necessary.&lt;/li&gt;
&lt;li&gt;Keeping the internal implementation hidden from code outside the class.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example: Encapsulation in Java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;`class Student {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Private variables
private String name;
private int age;

// Setter method
public void setName(String name) {
    this.name = name;
}

public void setAge(int age) {
    this.age = age;
}

// Getter methods
public String getName() {
    return name;
}

public int getAge() {
    return age;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;`public class Main {&lt;br&gt;
    public static void main(String[] args) {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    Student s1 = new Student();

    // Setting values
    s1.setName("Gowtham");
    s1.setAge(21);

    // Getting values
    System.out.println(s1.getName());
    System.out.println(s1.getAge());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Gowtham&lt;br&gt;
21&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advantages of Encapsulation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protects an object's internal data from direct access.&lt;/li&gt;
&lt;li&gt;Allows validation before data is modified.&lt;/li&gt;
&lt;li&gt;Makes code easier to maintain and modify.&lt;/li&gt;
&lt;li&gt;Keeps related data and methods together in one class.&lt;/li&gt;
&lt;li&gt;Reduces dependency on the internal implementation of a class.&lt;/li&gt;
&lt;li&gt;Provides better control over how an object's state can be accessed or changed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Limitations of Encapsulation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can increase the amount of code when many accessor methods are required.&lt;/li&gt;
&lt;li&gt;May add unnecessary complexity for very simple classes.&lt;/li&gt;
&lt;li&gt;Requires careful design to decide which data and operations should be exposed.&lt;/li&gt;
&lt;li&gt;Excessive use of getters and setters can expose more of a class's internal state than necessary.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>learning</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Python - Operators, Functions &amp; Function Arguments</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Sun, 01 Nov 2026 05:36:31 +0000</pubDate>
      <link>https://dev.to/gowtham_s/python-operators-functions-function-arguments-481a</link>
      <guid>https://dev.to/gowtham_s/python-operators-functions-function-arguments-481a</guid>
      <description>&lt;h2&gt;
  
  
  1.Operators in Python
&lt;/h2&gt;

&lt;p&gt;Operators are special symbols or keywords used to perform operations on variables and values.&lt;/p&gt;

&lt;p&gt;Python has different types of operators.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A.Arithmetic Operators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Arithmetic operators are used to perform mathematical calculations.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;B.Comparison Operators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Comparison operators are used to compare two values. They return either True or False.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftb0fsoxma07axiltuabe.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftb0fsoxma07axiltuabe.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C.Logical Operators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Logical operators are used to combine multiple conditions.&lt;/p&gt;

&lt;p&gt;Python has three logical operators:&lt;/p&gt;

&lt;p&gt;1.&lt;strong&gt;and&lt;/strong&gt; – Returns True if both conditions are true.&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;or&lt;/strong&gt; – Returns True if at least one condition is true.&lt;/p&gt;

&lt;p&gt;3.&lt;strong&gt;not&lt;/strong&gt; – Reverses the result.&lt;/p&gt;

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

&lt;p&gt;age = 20&lt;/p&gt;

&lt;p&gt;print(age &amp;gt; 18 and age &amp;lt; 30)&lt;br&gt;
print(age &amp;lt; 18 or age == 20)&lt;br&gt;
print(not(age &amp;gt; 18))&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;True&lt;br&gt;
True&lt;br&gt;
False&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;D.Assignment Operators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Assignment operators are used to assign values to variables.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fttsht7dbyb45j9mt9dbm.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fttsht7dbyb45j9mt9dbm.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;E.Membership Operators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Membership operators are used to check whether a value exists in a sequence.&lt;/p&gt;

&lt;p&gt;1.&lt;strong&gt;in&lt;/strong&gt; – Checks whether a value exists.&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;not in&lt;/strong&gt; – Checks whether a value does not exist.&lt;/p&gt;

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

&lt;p&gt;fruits = ["apple", "banana", "mango"]&lt;/p&gt;

&lt;p&gt;print("apple" in fruits)&lt;br&gt;
print("orange" not in fruits)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;True&lt;br&gt;
True&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;F.Identity Operators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Identity operators are used to check whether two variables refer to the same object.&lt;/p&gt;

&lt;p&gt;1.&lt;strong&gt;is&lt;/strong&gt; – Returns True if both refer to the same object.&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;is not&lt;/strong&gt; – Returns True if they refer to different objects.&lt;/p&gt;

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

&lt;p&gt;a = [1, 2, 3]&lt;br&gt;
b = a&lt;/p&gt;

&lt;p&gt;print(a is b)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;G.Bitwise Operators&lt;/strong&gt;&lt;/p&gt;

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

&lt;h2&gt;
  
  
  2.Functions in Python
&lt;/h2&gt;

&lt;p&gt;A function is a block of reusable code that performs a specific task.&lt;/p&gt;

&lt;p&gt;Functions help us avoid writing the same code repeatedly and make programs easier to understand.&lt;/p&gt;

&lt;p&gt;Python provides two main ways to work with functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built-in functions&lt;/li&gt;
&lt;li&gt;User-defined functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;A.Built-in Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Built-in functions are already available in Python. We can use them directly without defining them.&lt;/p&gt;

&lt;p&gt;Some common built-in functions are:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fquez595vh2u6nyvi9o0n.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fquez595vh2u6nyvi9o0n.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;B.User-Defined Functions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;User-defined functions are functions created by programmers to perform specific tasks.&lt;/p&gt;

&lt;p&gt;We use the def keyword to create a function.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Syntax:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;def function_name():&lt;br&gt;
    # Statements&lt;/p&gt;

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

&lt;p&gt;def greet():&lt;br&gt;
    print("Hello, Welcome to Python!")&lt;/p&gt;

&lt;p&gt;greet()&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Output:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hello, Welcome to Python!&lt;/p&gt;

&lt;p&gt;Here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;def is used to define a function.&lt;/li&gt;
&lt;li&gt;greet is the function name.&lt;/li&gt;
&lt;li&gt;greet() is used to call the function.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3.Function Arguments in Python
&lt;/h2&gt;

&lt;p&gt;Function arguments are values passed to a function when calling it. They allow us to send information to a function.&lt;/p&gt;

&lt;p&gt;Let's understand the different types of function arguments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A.Positional Arguments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In positional arguments, values are passed according to the order of parameters.&lt;/p&gt;

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

&lt;p&gt;def student(name, age):&lt;br&gt;
    print("Name:", name)&lt;br&gt;
    print("Age:", age)&lt;/p&gt;

&lt;p&gt;student("Gowtham", 20)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Output:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Name: Gowtham&lt;br&gt;
Age: 20&lt;/p&gt;

&lt;p&gt;Here, "Gowtham" is passed to name, and 20 is passed to age.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;B.Keyword Arguments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In keyword arguments, we pass values using parameter names. The order does not matter.&lt;/p&gt;

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

&lt;p&gt;def student(name, age):&lt;br&gt;
    print("Name:", name)&lt;br&gt;
    print("Age:", age)&lt;/p&gt;

&lt;p&gt;student(age=20, name="Gowtham")&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Output:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Name: Gowtham&lt;br&gt;
Age: 20&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C.Default Arguments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Default arguments have predefined values. If we don't pass a value, Python uses the default value.&lt;/p&gt;

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

&lt;p&gt;def greet(name="Friend"):&lt;br&gt;
    print("Hello", name)&lt;/p&gt;

&lt;p&gt;greet()&lt;br&gt;
greet("Gowtham")&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Output:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hello Friend&lt;br&gt;
Hello Gowtham&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;D.Variable-Length Arguments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes, we don't know how many arguments will be passed to a function. Python supports variable-length arguments.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1.*args&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;*args allows us to pass multiple positional arguments to a function.&lt;/p&gt;

&lt;p&gt;def add(*numbers):&lt;br&gt;
    print(sum(numbers))&lt;/p&gt;

&lt;p&gt;add(10, 20)&lt;br&gt;
add(10, 20, 30, 40)&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;30&lt;br&gt;
100&lt;/p&gt;

&lt;p&gt;&lt;em&gt;2.**kwargs&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;**kwargs allows us to pass multiple keyword arguments to a function. These arguments are stored as a dictionary.&lt;/p&gt;

&lt;p&gt;def student(**details):&lt;br&gt;
    print(details)&lt;/p&gt;

&lt;p&gt;student(name="Gowtham", age=20, city="Chennai")&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;{'name': 'Gowtham', 'age': 20, 'city': 'Chennai'}&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>learning</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Java - Constructor &amp; Constructor Overloading</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Sat, 31 Oct 2026 16:41:09 +0000</pubDate>
      <link>https://dev.to/gowtham_s/java-constructor-constructor-overloading-45d9</link>
      <guid>https://dev.to/gowtham_s/java-constructor-constructor-overloading-45d9</guid>
      <description>&lt;h2&gt;
  
  
  1.Constructor in Java:
&lt;/h2&gt;

&lt;p&gt;A constructor is a special member of a class that is used to initialize objects.&lt;/p&gt;

&lt;p&gt;A constructor is automatically called when an object is created using the new keyword.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important Features of Constructors&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The constructor name must be the same as the class name.&lt;/li&gt;
&lt;li&gt;A constructor does not have a return type, not even void.&lt;/li&gt;
&lt;li&gt;It is called automatically when an object is created.&lt;/li&gt;
&lt;li&gt;Constructors can have parameters.&lt;/li&gt;
&lt;li&gt;Constructors can be overloaded.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;`class Student {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Student() {
    System.out.println("Constructor Called!");
}

public static void main(String[] args) {
    Student s1 = new Student();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Constructor Called!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Student is the class name.&lt;/li&gt;
&lt;li&gt;Student() is the constructor.&lt;/li&gt;
&lt;li&gt;new Student() creates an object.&lt;/li&gt;
&lt;li&gt;The constructor is automatically executed when the object is created.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2.Types of Constructors in Java
&lt;/h2&gt;

&lt;p&gt;Java constructors are commonly explained using two categories:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.Default Constructor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If we do not write any constructor in a class, the Java compiler provides a default constructor.&lt;/p&gt;

&lt;p&gt;It initializes instance variables with their default values.&lt;/p&gt;

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

&lt;p&gt;`class Student {&lt;br&gt;
    int age;&lt;br&gt;
    String name;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static void main(String[] args) {
    Student s1 = new Student();

    System.out.println(s1.age);
    System.out.println(s1.name);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;0&lt;br&gt;
null&lt;/p&gt;

&lt;p&gt;Here, Java provides a default constructor because we did not define any constructor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If we write our own constructor, the compiler does not automatically provide a default constructor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.No-Argument Constructor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A no-argument constructor is a constructor written by the programmer that does not accept any parameters.&lt;/p&gt;

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

&lt;p&gt;`class Student {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Student() {
    System.out.println("Welcome to Java!");
}

public static void main(String[] args) {
    Student s1 = new Student();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Welcome to Java!&lt;/p&gt;

&lt;p&gt;Here, Student() is a programmer-defined no-argument constructor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.Parameterized Constructor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A parameterized constructor accepts arguments to initialize object values.&lt;/p&gt;

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

&lt;p&gt;`class Student {&lt;br&gt;
    String name;&lt;br&gt;
    int age;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Student(String n, int a) {
    name = n;
    age = a;
}

void display() {
    System.out.println(name);
    System.out.println(age);
}

public static void main(String[] args) {
    Student s1 = new Student("Gowtham", 20);
    s1.display();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Gowtham&lt;br&gt;
20&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Student(String n, int a) is a parameterized constructor.&lt;/li&gt;
&lt;li&gt;name = n assigns the name.&lt;/li&gt;
&lt;li&gt;age = a assigns the age.&lt;/li&gt;
&lt;li&gt;new Student("Gowtham", 20) creates an object and passes values to the constructor.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3.Constructor Overloading in Java:
&lt;/h2&gt;

&lt;p&gt;Constructor overloading means creating multiple constructors in the same class with different parameter lists.&lt;/p&gt;

&lt;p&gt;It allows us to initialize objects in different ways.&lt;/p&gt;

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

&lt;p&gt;`class Student {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String name;
int age;

Student() {
    name = "Unknown";
    age = 0;
}

Student(String n) {
    name = n;
    age = 18;
}

Student(String n, int a) {
    name = n;
    age = a;
}

void display() {
    System.out.println(name + " " + age);
}

public static void main(String[] args) {

    Student s1 = new Student();
    Student s2 = new Student("Gowtham");
    Student s3 = new Student("Arun", 21);

    s1.display();
    s2.display();
    s3.display();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unknown 0&lt;br&gt;
Gowtham 18&lt;br&gt;
Arun 21&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In this example, we have created three constructors:&lt;/li&gt;
&lt;li&gt;Student() – No-argument constructor.&lt;/li&gt;
&lt;li&gt;Student(String n) – Constructor with one parameter.&lt;/li&gt;
&lt;li&gt;Student(String n, int a) – Constructor with two parameters.&lt;/li&gt;
&lt;li&gt;Java automatically selects the matching constructor based on the arguments passed when creating an object.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6.Advantages of Constructor Overloading
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Flexibility&lt;/strong&gt;: Create objects with different initial values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code reusability&lt;/strong&gt;: Avoid repeating initialization logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Easy to use&lt;/strong&gt;: Choose a constructor based on the available information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Better organization&lt;/strong&gt;: Keep object initialization inside the class.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>learning</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Python - Variables, Reserved Words &amp; Data Types</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Thu, 29 Oct 2026 15:50:23 +0000</pubDate>
      <link>https://dev.to/gowtham_s/python-variables-reserved-words-and-data-types-2f9e</link>
      <guid>https://dev.to/gowtham_s/python-variables-reserved-words-and-data-types-2f9e</guid>
      <description>&lt;h2&gt;
  
  
  1.Variables in Python
&lt;/h2&gt;

&lt;p&gt;A variable is a name used to store a value in a program. In Python, we don't need to declare the variable type explicitly. Python automatically identifies the type of value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;`name = "Gowtham"&lt;br&gt;
age = 20&lt;br&gt;
price = 99.5&lt;/p&gt;

&lt;p&gt;print(name)&lt;br&gt;
print(age)&lt;br&gt;
print(price)`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Gowtham&lt;br&gt;
20&lt;br&gt;
99.5&lt;/p&gt;

&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;name stores a string value.&lt;/li&gt;
&lt;li&gt;age stores an integer value.&lt;/li&gt;
&lt;li&gt;price stores a floating-point value.&lt;/li&gt;
&lt;li&gt;Rules for Naming Variables&lt;/li&gt;
&lt;li&gt;A variable name can contain letters, numbers, and underscores.&lt;/li&gt;
&lt;li&gt;A variable name must not start with a number.&lt;/li&gt;
&lt;li&gt;Variable names are case-sensitive.&lt;/li&gt;
&lt;li&gt;Spaces are not allowed in variable names.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reserved words cannot be used as variable names.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Valid variable names:&lt;br&gt;
name = "Python"&lt;br&gt;
age = 20&lt;br&gt;
student_name = "Ravi"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Invalid variable names:&lt;br&gt;
2name = "Ravi"   # Starts with a number&lt;br&gt;
student name = "Ravi"  # Contains a space&lt;br&gt;
class = 10       # Reserved word&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2.Reserved Words in Python
&lt;/h2&gt;

&lt;p&gt;Reserved words, also called keywords, are words that have special meanings in Python. They are used to define the structure and behavior of a program.&lt;/p&gt;

&lt;p&gt;We cannot use these keywords as variable names or function names.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Python Keywords&lt;/strong&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Febicpga6d65qk7xf3std.jpg" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Febicpga6d65qk7xf3std.jpg" alt=" " width="800" height="1035"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3.Data Types in Python
&lt;/h2&gt;

&lt;p&gt;A data type specifies the kind of value stored in a variable. Python provides several built-in data types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.Numeric Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integer&lt;/strong&gt; (int) — Stores whole numbers.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;age = 20&lt;br&gt;
print(age)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Float&lt;/strong&gt; (float) — Stores decimal numbers.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;price = 99.5&lt;br&gt;
print(price)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Complex&lt;/strong&gt; (complex) — Stores complex numbers.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;number = 2 + 3j&lt;br&gt;
print(number)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.String (str)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A string stores text inside single or double quotation marks.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;name = "Python"&lt;br&gt;
print(name)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Python&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.Boolean (bool)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Boolean represents either True or False.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;is_student = True&lt;br&gt;
print(is_student)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;True&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.List (list)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A list stores multiple items in a single variable. Lists are ordered and mutable, meaning their contents can be changed.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fruits = ["apple", "banana", "mango"]&lt;br&gt;
print(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.Tuple (tuple)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A tuple stores multiple items. Unlike lists, tuples cannot be changed after creation.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;colors = ("red", "green", "blue")&lt;br&gt;
print(colors)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6.Set (set)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A set stores unique values and does not guarantee a fixed order.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;numbers = {1, 2, 3, 3}&lt;br&gt;
print(numbers)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The duplicate value 3 is stored only once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7.Dictionary (dict)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A dictionary stores information as key-value pairs.&lt;/p&gt;

&lt;p&gt;`student = {&lt;br&gt;
    "name": "Ravi",&lt;br&gt;
    "age": 20&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;print(student["name"])`&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Ravi&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8.None Type (NoneType)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;None represents the absence of a value.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;result = None&lt;br&gt;
print(result)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;None&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>learning</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Java - Methods &amp; Method Overloading</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Wed, 28 Oct 2026 17:55:36 +0000</pubDate>
      <link>https://dev.to/gowtham_s/java-methods-method-overloading-24f</link>
      <guid>https://dev.to/gowtham_s/java-methods-method-overloading-24f</guid>
      <description>&lt;h2&gt;
  
  
  1.Method in Java:
&lt;/h2&gt;

&lt;p&gt;A method is a block of code that performs a specific task. We can call a method whenever we need to execute that task.&lt;/p&gt;

&lt;p&gt;Methods help us avoid repeating the same code multiple times.&lt;/p&gt;

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

&lt;p&gt;`public class Main {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static void greet() {
    System.out.println("Hello, Welcome to Java!");
}

public static void main(String[] args) {
    greet();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hello, Welcome to Java!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;static allows us to call the method using the class without creating an object.&lt;/li&gt;
&lt;li&gt;void means the method does not return a value.&lt;/li&gt;
&lt;li&gt;greet() is the method name.&lt;/li&gt;
&lt;li&gt;System.out.println() displays the message.&lt;/li&gt;
&lt;li&gt;greet(); calls the method.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2.Types of Methods in Java
&lt;/h2&gt;

&lt;p&gt;Methods can be categorized in different ways. Two common types are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.Predefined Methods&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Predefined methods are already provided by Java's libraries.&lt;/p&gt;

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

&lt;p&gt;`public class Main {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        System.out.println("Hello Java!");&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    int result = Math.max(10, 20);
    System.out.println(result);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hello Java!&lt;br&gt;
20&lt;/p&gt;

&lt;p&gt;Here, println() and Math.max() are predefined methods.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.User-Defined Methods&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;User-defined methods are created by programmers to perform specific tasks.&lt;/p&gt;

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

&lt;p&gt;`public class Main {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static void add() {
    int a = 10;
    int b = 20;

    System.out.println(a + b);
}

public static void main(String[] args) {
    add();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;30&lt;/p&gt;

&lt;p&gt;Here, add() is a user-defined method.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.Methods with Parameters and Return Values:
&lt;/h2&gt;

&lt;p&gt;A method can accept parameters and return a result.&lt;/p&gt;

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

&lt;p&gt;`public class Main {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static int add(int a, int b) {
    return a + b;
}

public static void main(String[] args) {
    int result = add(10, 20);
    System.out.println(result);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;30&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;int a and int b are parameters.&lt;/li&gt;
&lt;li&gt;return a + b; returns the sum.&lt;/li&gt;
&lt;li&gt;add(10, 20) calls the method with two arguments.&lt;/li&gt;
&lt;li&gt;The returned result is stored in the result variable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4.Method Overloading in Java:
&lt;/h2&gt;

&lt;p&gt;Method overloading means creating multiple methods with the same name but different parameter lists within the same class.&lt;/p&gt;

&lt;p&gt;The methods can have different numbers of parameters or different parameter types.&lt;/p&gt;

&lt;p&gt;Method overloading makes code easier to understand because related operations can share the same method name.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1: Different Number of Parameters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;`public class Main {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static int add(int a, int b) {
    return a + b;
}

static int add(int a, int b, int c) {
    return a + b + c;
}

public static void main(String[] args) {
    System.out.println(add(10, 20));
    System.out.println(add(10, 20, 30));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;30&lt;br&gt;
60&lt;/p&gt;

&lt;p&gt;Here, both methods have the name add, but one accepts two parameters and the other accepts three.&lt;/p&gt;

&lt;p&gt;Java selects the appropriate method based on the arguments supplied.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 2: Different Parameter Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;`public class Main {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static int display(int a) {
    return a;
}

static double display(double a) {
    return a;
}

public static void main(String[] args) {
    System.out.println(display(10));
    System.out.println(display(10.5));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;10&lt;br&gt;
10.5&lt;/p&gt;

&lt;p&gt;The first method accepts an int, while the second accepts a double.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Changing only the return type is not enough to overload a method. The parameter list must be different.&lt;/p&gt;

&lt;h2&gt;
  
  
  5.Advantages of Methods and Method Overloading:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Code reusability: Write code once and call it multiple times.&lt;/li&gt;
&lt;li&gt;Readability: Give meaningful names to operations.&lt;/li&gt;
&lt;li&gt;Less duplication: Avoid writing similar code repeatedly.&lt;/li&gt;
&lt;li&gt;Flexibility: Method overloading supports different input types and numbers of arguments.&lt;/li&gt;
&lt;li&gt;Easy maintenance: Organize programs into smaller, manageable parts.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>learning</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Python - Introduction</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Tue, 27 Oct 2026 07:05:28 +0000</pubDate>
      <link>https://dev.to/gowtham_s/python-introduction-2d5h</link>
      <guid>https://dev.to/gowtham_s/python-introduction-2d5h</guid>
      <description>&lt;h2&gt;
  
  
  What Is Python?
&lt;/h2&gt;

&lt;p&gt;Python is a popular, high-level programming language known for its simple syntax and readability. It was created by Guido van Rossum and first released in 1991.&lt;/p&gt;

&lt;p&gt;Python is easy to learn, making it a great choice for beginners who want to start their programming journey.&lt;/p&gt;

&lt;p&gt;Python is used in web development, data science, artificial intelligence, machine learning, automation, and many other fields.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Should We Learn Python?
&lt;/h2&gt;

&lt;p&gt;There are several reasons to learn Python:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Easy to Learn&lt;/strong&gt;: Python has simple and readable syntax.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Beginner-Friendly&lt;/strong&gt;: You can write programs with fewer lines of code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Versatile&lt;/strong&gt;: Python can be used for many different types of applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Large Community&lt;/strong&gt;: Many developers share tutorials, libraries, and solutions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open Source&lt;/strong&gt;: Python is free to use.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  First Python Program
&lt;/h2&gt;

&lt;p&gt;Let's write our first Python program!&lt;/p&gt;

&lt;p&gt;&lt;code&gt;print("Hello, World!")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Hello, World!&lt;/p&gt;

&lt;p&gt;The print() function displays text or other values on the screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Features of Python
&lt;/h2&gt;

&lt;p&gt;Python provides several useful features:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Simple Syntax&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python code is easy to read and understand.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;name = "Gowtham"&lt;br&gt;
print(name)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;Gowtham&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Variables are used to store data.&lt;/p&gt;

&lt;p&gt;`name = "Python"&lt;br&gt;
age = 35&lt;/p&gt;

&lt;p&gt;print(name)&lt;br&gt;
print(age)`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Data Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python supports different types of data, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;int — Integer numbers, such as 10&lt;/li&gt;
&lt;li&gt;float — Decimal numbers, such as 10.5&lt;/li&gt;
&lt;li&gt;str — Text, such as "Hello"&lt;/li&gt;
&lt;li&gt;bool — Boolean values, such as True and False&lt;/li&gt;
&lt;li&gt;list — A collection of items, such as [1, 2, 3]&lt;/li&gt;
&lt;li&gt;dict — Data stored as key-value pairs, such as {"name": "Gowtham"}&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Cross-Platform&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python works on different operating systems, including Windows, Linux, and macOS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Is Python Used?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python is widely used in different areas of technology:&lt;/li&gt;
&lt;li&gt;Web Development: Building websites and web applications.&lt;/li&gt;
&lt;li&gt;Data Science: Analyzing and understanding data.&lt;/li&gt;
&lt;li&gt;Artificial Intelligence: Developing intelligent applications.&lt;/li&gt;
&lt;li&gt;Machine Learning: Building systems that learn from data.&lt;/li&gt;
&lt;li&gt;Automation: Automating repetitive tasks.&lt;/li&gt;
&lt;li&gt;Game Development: Creating simple games and game tools.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>learning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Java - Variables &amp; Objects</title>
      <dc:creator>Gowtham</dc:creator>
      <pubDate>Sun, 25 Oct 2026 16:24:22 +0000</pubDate>
      <link>https://dev.to/gowtham_s/java-variables-objects-c2o</link>
      <guid>https://dev.to/gowtham_s/java-variables-objects-c2o</guid>
      <description>&lt;h2&gt;
  
  
  Variable in Java:
&lt;/h2&gt;

&lt;p&gt;A variable is a named storage location used to hold a value of a particular data type.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;int age = 20;&lt;br&gt;
String name = "Gowtham";&lt;/p&gt;

&lt;p&gt;Here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;int is the data type.&lt;/li&gt;
&lt;li&gt;age is the variable name.&lt;/li&gt;
&lt;li&gt;20 is the value stored in the variable.&lt;/li&gt;
&lt;li&gt;String is the type used to represent text.&lt;/li&gt;
&lt;li&gt;name is the variable name.&lt;/li&gt;
&lt;li&gt;"Gowtham" is the text value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Types of Variables in Java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Java has three main categories of variables based on where they are declared.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Local Variable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A local variable is declared inside a method, constructor, or block.&lt;/p&gt;

&lt;p&gt;void display() {&lt;br&gt;
    int age = 20;&lt;br&gt;
    System.out.println(age);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Instance Variable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An instance variable is declared inside a class but outside methods. Each object has its own instance fields.&lt;/p&gt;

&lt;p&gt;class Student {&lt;br&gt;
    String name = "Gowtham";&lt;br&gt;
    int age = 20;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Static Variable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A static variable belongs to the class rather than to individual objects.&lt;/p&gt;

&lt;p&gt;class Student {&lt;br&gt;
    static String college = "ABC College";&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;The static variable college is shared at the class level.&lt;/p&gt;

&lt;h2&gt;
  
  
  Object in Java?
&lt;/h2&gt;

&lt;p&gt;An object is an instance of a class.&lt;/p&gt;

&lt;p&gt;A class defines the data and behaviors that its objects can have.&lt;/p&gt;

&lt;p&gt;For example, Student can be a class, while individual students can be represented by objects of that class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;`class Student {&lt;br&gt;
    String name;&lt;br&gt;
    int age;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void display() {
    System.out.println(name);
    System.out.println(age);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;public class Main {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        Student s1 = new Student();&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    s1.name = "Gowtham";
    s1.age = 20;

    s1.display();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Gowtham&lt;br&gt;
20&lt;/p&gt;

&lt;p&gt;Explanation&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Student is the class.&lt;/li&gt;
&lt;li&gt;s1 is a reference variable.&lt;/li&gt;
&lt;li&gt;new Student() creates a new Student object.&lt;/li&gt;
&lt;li&gt;s1.name assigns a name to the object.&lt;/li&gt;
&lt;li&gt;s1.age assigns an age to the object.&lt;/li&gt;
&lt;li&gt;s1.display() calls the object's method.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>fullstack</category>
      <category>learning</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
