<?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: Sangamithra K</title>
    <description>The latest articles on DEV Community by Sangamithra K (@sangamithra_k_78d83d6fb9d).</description>
    <link>https://dev.to/sangamithra_k_78d83d6fb9d</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%2F2992089%2F742e4d60-dbb3-4a0f-929b-67fb3511c0d4.jpg</url>
      <title>DEV Community: Sangamithra K</title>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sangamithra_k_78d83d6fb9d"/>
    <language>en</language>
    <item>
      <title>DAY 40: Array in Looping JAVA</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Thu, 08 May 2025 02:57:38 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-40-array-in-looping-java-18ff</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-40-array-in-looping-java-18ff</guid>
      <description>&lt;p&gt;In Java, an array is a data structure that stores a fixed-size, sequential collection of elements of the same data type. It is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created and remains fixed throughout its lifetime. Arrays are used to organize data efficiently and can be defined and initialized in various ways.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Array - Group of similar datatypes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why do you use an array?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Arrays are handy when you want to work with multiple values of the same data type. Instead of declaring individual variables for each value, you can group them together in an array, making your code more concise and easier to manage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Index / Subscript:  0   1   2   3   4

marks[0] = 90;  
marks[1] = 95; 
marks[2] = 100; 
marks[3] = 78; 
marks[4] = 94;

System.out.println(marks[0]); 
System.out.println(marks[1]); 
System.out.println(marks[2]); 
System.out.println(marks[3]); 
System.out.println(marks[4]); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int i =0; 
System.out.println(marks[i]); i = i+1; 
System.out.println(marks[i]); i = i+1;
System.out.println(marks[i]); i = i+1;
System.out.println(marks[i]); i = i+1;
System.out.println(marks[i]); i = i+1;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we add while loop&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int i =0; 
while(i&amp;lt;5)
{
System.out.println(marks[i]); 
i = i+1; 
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int i =0;  //Initial Value  Only Once
while(i&amp;lt;marks.length)   // Condition - How many times - Every time before
{
System.out.println(marks[i]); 
i = i+1; //Increment - Decrement: Every time After execution
}

while --&amp;gt; for loop: 

for(int i =0; i&amp;lt;marks.length; i = i+1)
{
System.out.println(marks[i]); 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using Scanner&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Scanner scanner = new Scanner(System.in);
        System.out.println("Enter Mark:");
        int mark1 = scanner.nextInt();
        System.out.println("hi "+ mark1);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;input()
scanner.next()

Scanner scans the next token from user (From console)

Scanner scanner = new Scanner(System.in);
System.out.println("Tell Me your name ");
String name = scanner.nextLine();
System.out.println("Welcome to Java "+ name);


        Scanner scanner = new Scanner(System.in);

        int mark1 = scanner.nextInt(); 
        int mark2 = scanner.nextInt(); 
        int mark3 = scanner.nextInt(); 

        Scanner scanner = new Scanner(System.in);

        int[] marks = new int[5]; 

         marks[0] = scanner.nextInt(); 
         marks[1]= scanner.nextInt(); 
         marks[2] = scanner.nextInt(); 
         marks[3]= scanner.nextInt(); 
         marks[4] = scanner.nextInt(); 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Day 38: Find power, Common divisors, LCM in Looping Practices</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Tue, 06 May 2025 03:59:10 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-38-find-power-common-divisors-lcm-in-looping-practices-1od7</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-38-find-power-common-divisors-lcm-in-looping-practices-1od7</guid>
      <description>&lt;p&gt;&lt;strong&gt;Example 1 find power:&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;package demo_programs;

public class Find_power {
    private boolean find_prime(int no) {
        // TODO Auto-generated method stub
        int div = 2; 
        while(div&amp;lt;no)
        {
            if(Example 2 Find common divisorsno%div ==0)
            {
                return false; 
            }
            div=div+1; //div+=1; 
        }
        return true; 
    }}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 2 Find common divisors&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;package demo_programs;

public class Find_CommonDivisors {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
      Find_CommonDivisors find=new Find_CommonDivisors();
      find.find_divisors(100, 120);
      }

    private void find_divisors(int no1, int no2) {
        // TODO Auto-generated method stub
        int div =2;
        int small=0;
        while (div&amp;lt;=small) {
            if( no1%div==0 &amp;amp;&amp;amp; no2%div==0);
            System.out.println(div);
         div+=1;
        }
    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 3 LCM&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;package demo_programs;

public class LCM_01 {
     int no1 =3, no2 = 30;
     int big = no1&amp;gt;no2 ? no1:no2;{
        //  while (true){
            if (big%no1 == 0 &amp;amp;&amp;amp; big%no2 == 0);
                  System.out.println("LCM is" + big);
           big+=1;}
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Day 37: Looping Practice&amp; find divisors of count</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Mon, 05 May 2025 03:59:59 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-37-looping-practice-find-divisors-of-count-59j5</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-37-looping-practice-find-divisors-of-count-59j5</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package demo_programs;

public class Looping3 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int total=8;
        int count=3;
       int eaten=0;

        while (count&amp;lt;=3){
          eaten = total/2;
            total+=eaten;
            count+=1;
        }System.out.println(total);
    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package demo_programs;

public class Looping4 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
                int box = 1024;
                int securityCount = 0;
                while (box &amp;gt; 1) {
                    securityCount += 1;
                    box = box / 2;
                }
                System.out.println(securityCount);

    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Find divisors count of given Numbers&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;package demo_programs;

public class Looping5 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
       int no=20;
       int div=1;
       int count_of_divisors = 0;
       while (div&amp;lt;=no) {
           if (no%div == 0) 
           System.out.println(div);
               //count_of_divisors = count_of_divisors + 1
               count_of_divisors+=1;
          div+=1 ;      }}}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Day 35 &amp; 36: Looping Demo of Factorial and LCM</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Sun, 04 May 2025 17:11:20 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-35-36-looping-demo-of-factorial-and-lcm-5cf2</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-35-36-looping-demo-of-factorial-and-lcm-5cf2</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is factorial in Java programming?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Java programming, a factorial is the mathematical operation of finding the product of all positive integers up to a given number nnn&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package demo_programs;

public class Looping{

    public static void main(String[] args) {
        // TODO Auto-generated method stub
         Looping l = new Looping();
         l.find_factorial(4);

    }

    private void find_factorial(int no) {
        // TODO Auto-generated method stub
        int factorial=1;
        while (no&amp;gt;=1){
            factorial=factorial*no;
            no=no-1;
        }   
        System.out.println(factorial);

    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;lead code programming&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;package demo_programs;

public class Looping2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
         int choco=15;
         int wrapper=15;
         while (wrapper&amp;gt;=3){
             wrapper =wrapper -3;
             choco=choco+1;
             wrapper = wrapper+1;

         }
        System.out.println("The total number of choco is "+choco);  
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Day 34 :While Loop Practice programmings</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Thu, 01 May 2025 03:09:20 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-34-loop-practice-programmings-4777</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-34-loop-practice-programmings-4777</guid>
      <description>&lt;p&gt;&lt;strong&gt;workout 1&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;package demo_programs;

public class example_6 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        int no = 5; 
        while(no&amp;gt;=-1)
        {
        System.out.print(no+" "); 
        no = no-1;
    }}}
//5 4 3 2 1 0 -1 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;workout 2&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;package demo_programs;

public class Example_6_2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int no = 10; //Starting Point
        while(no&amp;gt;=-2) //Ending Point
        {
        System.out.print(no+" "); 
        no = no-2; // Increment or decrement
        }
    }
}
//10 8 6 4 2 0 -2 
notes:-
10  8   6   4   2
System.out.print(10+" "); 
System.out.print(8+" "); 
System.out.print(6+" "); 
System.out.print(4+" "); 
System.out.print(2+" "); 

int no = 10; 
System.out.print(no+" "); 
no = no-2;
System.out.print(no+" "); 
no = no-2;
System.out.print(no+" "); 
no = no-2;
System.out.print(no+" "); 
no = no-2;
System.out.print(no+" "); 
no = no-2;

int no = 10; //Starting Point
while(no&amp;gt;=-2) //Ending Point
{
System.out.print(no+" "); 
no = no-2; // Increment or decrement
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Workout 3&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;package demo_programs;

public class Example_6_2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int no = 3; //Starting Point
        while(no&amp;lt;=15) //Ending Point
        {
        System.out.print(no+" "); 
        no = no+3; // Increment or decrement
        }
    }
}
//3 6 9 12 15 
notes
3   6   9   12  15
System.out.print(3+" "); 
System.out.print(6+" "); 
System.out.print(9+" "); 
System.out.print(12+" "); 
System.out.print(15+" "); 

int no = 3; 
System.out.print(no+" "); 
no = no+3;
System.out.print(no+" "); 
no = no+3;
System.out.print(no+" "); 
no = no+3;
System.out.print(no+" "); 
no = no+3;

int no = 3; //Starting Point
while(no&amp;lt;=15) //Ending Point
{
System.out.print(no+" "); 
no = no+3; // Increment or decrement
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Workout 4&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;package demo_programs;

public class Example_6_2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int no = 15; //Starting Point
        while(no&amp;gt;=-3) //Ending Point
        {
        System.out.print(no+" "); 
        no = no-3; // Increment or decrement
        }
    }
}
//15 12 9 6 3 0 -3 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Workout 5&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;package demo_programs;

public class Example_6_2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int no = 4; //Starting Point
        while(no&amp;lt;=20) //Ending Point
        {
        System.out.print(no+" "); 
        no = no+4; // Increment or decrement
        }
    }
}
//4 8 12 16 20 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Workout 6&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;package demo_programs;

public class Example_6_2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

int no = 10; //Starting Point
while(no&amp;lt;=50) //Ending Point
{
System.out.print(no+" "); 
no = no+10; // Increment or decrement
}
    }
}
//10 20 30 40 50 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Workout 7&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;package demo_programs;

public class Example_6_2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int no = 90; //Starting Point
        while(no&amp;gt;=15) //Ending Point
        {
        System.out.print(no+" "); 
        no = no-15; // Increment or decrement
        }
    }
}
//90 75 60 45 30 15 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Workout 8&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;package demo_programs;

public class Example_6_2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int no = 11; //Starting Point
        while(no&amp;lt;=55) //Ending Point
        {
        System.out.print(no+" "); 
        no = no+11; // Increment or decrement
        }
    }
}
//11 22 33 44 55 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>java</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day:33 Switch case and looping programming</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Wed, 30 Apr 2025 03:32:50 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day32-switch-case-and-looping-programming-52bc</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day32-switch-case-and-looping-programming-52bc</guid>
      <description>&lt;p&gt;In Java, == and equals() are both used for comparison, but they operate differently. The == operator checks for reference equality, meaning it compares whether two variables point to the same object in memory. In contrast, the equals() method, when properly implemented, compares the content or state of the objects. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, the main difference between "==" and "equals" in Java is that "==" compares the memory location of two objects, while "equals" compares the contents of two objects.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SWITCH KEYWORD&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Below is an example program demonstrating the switch keyword in Java. The switch statement evaluates an expression, matching its value against a series of case labels. If a match is found, the corresponding block of code is executed. The break statement is typically used to exit the switch block after a match, and the default case handles situations where no match is found.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package demo_programs;

public class SwitchExample {
    public static void main(String[] args) {
        int day = 1;
        String dayString;

        switch (day) {
            case 1:
                dayString = "Monday";
                break;
            case 2:
                dayString = "Tuesday";
                break;
            case 3:
                dayString = "Wednesday";
                break;
            default:
                dayString = "Invalid day";
        }
        System.out.println(dayString); // Output: Wednesday
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Remove break from case1, case2, case3?&lt;br&gt;
  &lt;strong&gt;What happens:&lt;/strong&gt;&lt;br&gt;
day = 1, so it matches case 1&lt;br&gt;
Since there's no break after case 1, it falls through to case 2&lt;br&gt;
dayString gets overwritten as "Tuesday"&lt;br&gt;
Then it hits break, so it exits the switch&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;More default just above any case block?&lt;br&gt;
  The default case is already defined&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;remove break statement from default?&lt;br&gt;
 the local variable dayString may not have been initialized.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;4.Instead of using int day, try using float values?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package demo_programs;

public class SwitchExample2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

                float day = 3.0f;
                String dayString;

                if (day == 1.0f) {
                    dayString = "Monday";
                } else if (day == 2.0f) {
                    dayString = "Tuesday";
                } else if (day == 3.0f) {
                    dayString = "Wednesday";
                } else {
                    dayString = "Invalid day";
                }

                System.out.println(dayString); // Output: Tuesday
            }}

//output Wednesday

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>java</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day : 32 "Byte by Byte: The Programmer’s Journey"</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Tue, 29 Apr 2025 03:35:57 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-32-byte-by-byte-the-programmers-journey-224m</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-32-byte-by-byte-the-programmers-journey-224m</guid>
      <description>&lt;p&gt;Java programs are typically structured into classes, which are blueprints for objects. Objects are instances of classes and contain data (fields) and methods (actions) that operate on that data. A simple "Hello, World!" program in Java demonstrates the basic structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In this program:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;public class Main declares a class named "Main".&lt;/li&gt;
&lt;li&gt;public static void main(String[] args) is the main method, the entry point of the program.&lt;/li&gt;
&lt;li&gt;System.out.println("Hello, World!"); prints the text "Hello, World!" to the console.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Normal Statement&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Conditional Statement&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Control Flow statement&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;why if and else statement in programming in java&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Java programming, the if and else statements are fundamental control flow structures used for decision-making. They allow a program to execute different blocks of code based on whether a specified condition is true or false.&lt;/li&gt;
&lt;li&gt;The if statement evaluates a boolean expression. If the expression is true, the code block within the if statement is executed. If the expression is false, the code block is skipped.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some examples of using this keywords &lt;strong&gt;If&lt;/strong&gt;, &lt;strong&gt;Else if&lt;/strong&gt; and &lt;strong&gt;Else&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 01&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;package demo_programs;

public class Example1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
     int no1= 6;
     int no2 = 6;

     if (no1&amp;gt;no2) {
   System.out.println(no1);  
     }else if (no2&amp;gt;no1) {
         System.out.println(no2);
     }else {System.out.println("Equal");
    }
} }
//output is Equal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 02&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;package demo_programs;

public class Example2 {
    public static void main(String[] args) {
        if (20 &amp;gt; 18) {
              System.out.println("20 is greater than 18");
            }

    }

}
//output is 20 is greater than 18

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 03&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;package demo_programs;

public class Example3 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int x = 20;
        int y = 18;
        if (x &amp;gt; y) {
          System.out.println("x is greater than y");
        }

    }

}
//x is greater than y

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 04&lt;/strong&gt; (TBH)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package demo_programs;

public class Example4{

        public static void main(String[] args) {
            // TODO Auto-generated method stub
            String fav1 ="Biryani";
            String fav2 ="Chicken fried rice";
            if (fav1.equals("Biryani")){
                System.out.println("Loves to eat biryani");
            }else if (fav2.equals("Chicken fried rice")) {
                System.out.println("Loves to eat Chicken fried rice");
            }else {
                System.out.println("take some different food");
            }

    }

}
//output Loves to eat biryani

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Nested if&lt;/strong&gt;&lt;br&gt;
Nested if refers to an if statement within an if statement. When we write an inner if condition within an outer if condition, then it is referred to as a nested if statement in java. Nested if is a decision-making statement that works similar to other decision-making statements such as if, else, if..else, etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 05&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;package demo_programs;

public class Example2 {
    public static void main(String[] args) {
        boolean yamakadhagi = false;
        if(yamakadhagi==true) {
             boolean horror = true;
        if (horror==true) {
             boolean interested = false;
        if (interested==true) {
            System.out.println("watching movie with families");
        }else if (interested==false) {
            System.out.println("watch the movie alone");
        }
            }
        }   else if (yamakadhagi==false) {
            System.out.println("Dragon movie");
        }
    }
}
//output is Dragon movie

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>DAY :31 This , Super class in JAVA.</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Wed, 23 Apr 2025 00:58:11 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-31-this-super-class-in-java-ng9</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-31-this-super-class-in-java-ng9</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is this keyword in Java?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Java, this is a reference variable that refers to the current object on which the method or constructor is being invoked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is this keyword used?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This keyword in Java refers to the 'current object' in a method or constructor. It is used to reduce the confusion between class attributes and parameters with the same name&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%2F9eo3xzxq95t8molniubu.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%2F9eo3xzxq95t8molniubu.png" alt="Image description" width="514" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is super class?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The super keyword in Java is a reference variable that refers to the immediate parent class object. It is primarily used in inheritance scenarios to access or call members (methods, variables, and constructors) of the superclass from within a subclass.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to use super keyword in java?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The super keyword in Java is used to access members of the superclass (parent class) from within a subclass.&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%2Fiz7wt7ymz5y7n3ice4fq.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%2Fiz7wt7ymz5y7n3ice4fq.png" alt="Image description" width="493" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day 28 and 30: java in Dynamic binding and Enum...Basic of Programming</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Mon, 21 Apr 2025 03:00:21 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-28-and-30-java-in-dynamic-binding-and-enumbasic-of-programming-4pjg</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-28-and-30-java-in-dynamic-binding-and-enumbasic-of-programming-4pjg</guid>
      <description>&lt;p&gt;&lt;strong&gt;What  is Dynamic binding?&lt;/strong&gt;&lt;br&gt;
Dynamic binding, also known as late binding, in Java refers to the resolution of method calls during runtime, based on the actual object's type, rather than the reference type. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key aspects of dynamic binding in Java:&lt;/strong&gt;&lt;br&gt;
 &lt;strong&gt;Runtime Resolution:&lt;/strong&gt;&lt;br&gt;
    The method to be called is determined at runtime, not compile-time. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Method Overriding:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dynamic binding is heavily reliant on method overriding, where a subclass provides its own implementation of a method inherited from a superclass. &lt;/p&gt;

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

&lt;p&gt;It enables polymorphism, allowing a single method call to invoke different implementations based on the object's type. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Object-Oriented Programming:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dynamic binding is a fundamental concept in object-oriented programming, enabling code reusability and flexibility. &lt;br&gt;
&lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;
When a subclass overrides a method from a superclass, the overridden method in the subclass is called at runtime based on the actual object type. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Virtual Methods:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Java, methods are virtual by default, meaning they are bound at runtime based on the object's type. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contrast with Static Binding:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Static binding, or early binding, resolves method calls at compile time based on the reference type. &lt;/p&gt;

&lt;p&gt;Abstract Classes Can have at least one abstract method? True&lt;/p&gt;

&lt;p&gt;Abstract classes SHOULD have at least one abstract method? False.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enum&lt;/strong&gt; Enumeration&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enum is a group of named constant objects&lt;/li&gt;
&lt;li&gt;Enum is our owned datatypes create the own reference&lt;/li&gt;
&lt;li&gt;by default, enum constant is public static and final.&lt;/li&gt;
&lt;li&gt;Enum constructors will be executed automatically at the time of enum loading.&lt;/li&gt;
&lt;li&gt;constant values will be created at the time of class loading&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;EXAMPLE 1&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;enum players

    public enum players
    {
    DHONI, KOHLI, BUMRAH
    } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;EXAMPLE 2&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.amazonaws.com%2Fuploads%2Farticles%2F1bow3d3l5hqy04vkqe9x.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%2F1bow3d3l5hqy04vkqe9x.png" alt="Image description" width="784" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is an enum in Java?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An enum is a special "class" that represents a group of constants (unchangeable variables, like final variables).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is enum used?&lt;/strong&gt;&lt;br&gt;
It is mainly used to define our own (pre-defined) data type. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;where can we create enum?&lt;/strong&gt;&lt;br&gt;
inside class as well as outside class&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to call enum in Java?&lt;/strong&gt;&lt;br&gt;
You call a Java enum method via a reference to one of the constant values&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[] square bracket called group&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BASICS OF PROGRAMMING:-&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Java programming involves writing code using the Java language to instruct a computer to perform specific tasks&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;programming Rules:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1) Don't say i don't know&lt;br&gt;
2) Always say - Let me try.&lt;br&gt;
3) Don't think about entire output.&lt;br&gt;
4) Think about very next step.&lt;br&gt;
5) Known to unknown&lt;br&gt;
6) write down the known steps.&lt;br&gt;
7) Think about variable. Add it if necessary.&lt;br&gt;
8) Micro to macro.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;some topics to understand programming are&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;datatypes, variables, = assignment operator&lt;br&gt;
method, method calling, arguments, return values&lt;/p&gt;

</description>
      <category>programming</category>
      <category>java</category>
      <category>basic</category>
      <category>enumeration</category>
    </item>
    <item>
      <title>DAY : 27 Abstract and Interface in Java – Simplified</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Thu, 17 Apr 2025 03:04:38 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-27-1gbc</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-27-1gbc</guid>
      <description>&lt;p&gt;&lt;strong&gt;Abstraction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.Abstraction in Java is a fundamental concept in object-oriented programming (OOP) that hides implementation details and only shows essential features.&lt;br&gt;
2.if at least one method is abstract in a class, then the entire class should be abstract&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key features of abstraction:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Abstraction hides the complex details and shows only essential features.&lt;/li&gt;
&lt;li&gt;Abstract classes may have methods without implementation and must be implemented by subclasses.&lt;/li&gt;
&lt;li&gt;By abstracting functionality, changes in the implementation do not affect the code that depends on the abstraction.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Important rules for abstract methods are mentioned below:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Any class that contains one or more abstract methods must also be declared abstract.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If a class contains an abstract method it needs to be abstract and vice versa is not true.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The following are various illegal combinations of other modifiers for methods with respect to abstract modifiers:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;final&lt;/li&gt;
&lt;li&gt;abstract native&lt;/li&gt;
&lt;li&gt;abstract synchronized&lt;/li&gt;
&lt;li&gt;abstract static&lt;/li&gt;
&lt;li&gt;abstract private&lt;/li&gt;
&lt;li&gt;abstract strictfp&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;How to Achieve Abstraction in Java?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Java provides two ways to implement abstraction, which are listed below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Abstract Classes (Partial Abstraction)&lt;/li&gt;
&lt;li&gt;Interface (100% Abstraction)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Interface&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Java, an interface defines a contract for classes to implement, specifying a set of abstract methods and constants. It's a blueprint for classes to adhere to, ensuring they provide certain functionalities. Interfaces allow for abstraction and enable multiple inheritance in Java.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why use interfaces?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Interfaces fulfill two goals: They allow the programmer to be more abstract when referencing objects (for example, var vehicle : Vehicle, can reference any car, truck, etc... anything that is a vehicle (and not care what type it is.) This occurs at "program time".&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>oop</category>
      <category>abstraction</category>
    </item>
    <item>
      <title>DAY : 26 Protected keyword and abstraction</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Wed, 16 Apr 2025 02:53:17 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-26-protected-keyword-and-abstraction-153l</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-26-protected-keyword-and-abstraction-153l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Protected keyword&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Java, the protected keyword acts as an access modifier for class members (fields and methods). It allows access to those members from within the same package, and by subclasses, even if they are in different packages. &lt;/p&gt;

&lt;p&gt;Prerequisites:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encapsulation&lt;/strong&gt;:&lt;br&gt;
1.private - we can use within the class.&lt;br&gt;
2.Default - we can use within the package&lt;br&gt;
3.Public - we can use within the projects.&lt;br&gt;
4.protected - we can use withing the package + child classes in other package.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Abstraction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.Abstraction in Java is a fundamental concept in object-oriented programming (OOP) that hides implementation details and only shows essential features.&lt;br&gt;
2.if at least one method is abstract in a class, then the entire class should be abstract&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%2Foef4ic6l40mo4i8b8vjv.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%2Foef4ic6l40mo4i8b8vjv.png" alt="Image description" width="783" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Abstract Methods and Classes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.&lt;/p&gt;

&lt;p&gt;An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon), like this:&lt;/p&gt;

&lt;p&gt;abstract void moveTo(double deltaX, double deltaY);&lt;/p&gt;

&lt;p&gt;If a class includes abstract methods, then the class itself must be declared abstract, as in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public abstract class GraphicObject {
   // declare fields
   // declare nonabstract methods
   abstract void draw();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Abstract only use in class and method. Not in a variable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class. However, if it does not, then the subclass must also be declared abstract.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>java</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>DAY 25: Mastering Constructors &amp; the this Keyword</title>
      <dc:creator>Sangamithra K</dc:creator>
      <pubDate>Tue, 15 Apr 2025 02:56:00 +0000</pubDate>
      <link>https://dev.to/sangamithra_k_78d83d6fb9d/day-25-mastering-constructors-the-this-keyword-4hh6</link>
      <guid>https://dev.to/sangamithra_k_78d83d6fb9d/day-25-mastering-constructors-the-this-keyword-4hh6</guid>
      <description>&lt;p&gt;&lt;strong&gt;constructor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Java, a constructor is a special method that initializes objects when they are created. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Should know about local and global variables&lt;/li&gt;
&lt;li&gt;global variables to non static variables&lt;/li&gt;
&lt;li&gt;default value of global variables&lt;/li&gt;
&lt;li&gt;return data types&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;1.&lt;strong&gt;Constructor will be called automatically when objects are created&lt;/strong&gt;&lt;br&gt;
2.&lt;strong&gt;Constructor names should be a class names&lt;/strong&gt;&lt;br&gt;
3.&lt;strong&gt;constructor will not have any return data types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are the 3 types of constructor?&lt;/strong&gt;&lt;br&gt;
1.Default &lt;br&gt;
2.Parameterized &lt;br&gt;
3.Copy constructors&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is default constructor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A default constructor in Java is a constructor automatically provided by the compiler if no constructors are explicitly defined in a class. It's a parameter-less (no argument) constructor that initializes instance variables to their default values (e.g., 0 for integers, null for objects, false for booleans.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;what is Parameterized constructor in java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A parameterized constructor in Java is a constructor that takes one or more arguments (parameters) during object creation. These parameters allow you to specify the initial values of the object's instance variables when the object is created. This contrasts with the default constructor, which takes no arguments and initializes instance variables with default values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;what is Copy constructors constructor in java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A copy constructor in a Java class is a constructor that creates an object using another object of the same Java class. That's helpful when we want to copy a complex object that has several fields, or when we want to make a deep copy of an existing object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When constructor is called automatically&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes, constructors are automatically called when a new object of a class is created. They are special methods used to initialize the object's state&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Constructor overloading in Java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Constructor overloading in Java allows a class to have multiple constructors with different parameter lists, all having the same name as the class. This enables the creation of objects with varying initial states, based on the arguments provided during object instantiation. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is this keyword in Java?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The this keyword in Java is a reference variable that refers to the current object. It is used within an instance method or a constructor to access members of the current object such as instance variables, methods, and constructors. &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 plaintext"&gt;&lt;code&gt;public class SuperMarket {

  String product_name;
  int price;
  int discount;
  private Object buy;


  public SuperMarket(String string, int i, int j) {
    // TODO Auto-generated constructor stub
    product_name = string;
    price = i;
    discount = j;  


  }
  public SuperMarket(String string, int i) {
    // TODO Auto-generated constructor stub
    product_name = string;
    price = i;
  }
  public SuperMarket() {
    // TODO Auto-generated constructor stub
    System.out.println("Material from London");
  }
  public static void main(String[] args) {
    SuperMarket product1 = new SuperMarket("maida", 90,8);
    SuperMarket product2 = new SuperMarket("tender_coconut", 45,2);
    SuperMarket product3 = new SuperMarket("maggi", 45); 
    SuperMarket product4 = new SuperMarket();



    System.out.println(product1.product_name  );
    System.out.println(product2.product_name );
    product1.buy();
}

public void buy() { 
  System.out.println(product_name + -price);
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Material from London
maida
tender_coconut
maida-90
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>java</category>
      <category>programming</category>
      <category>constructors</category>
    </item>
  </channel>
</rss>
