<?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: Benjamin Rukundo</title>
    <description>The latest articles on DEV Community by Benjamin Rukundo (@rukundob451).</description>
    <link>https://dev.to/rukundob451</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%2F671180%2F7ef5fdc6-e9bd-4e38-a5b2-e6f24009c556.jpg</url>
      <title>DEV Community: Benjamin Rukundo</title>
      <link>https://dev.to/rukundob451</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rukundob451"/>
    <language>en</language>
    <item>
      <title>Google I/O Extended 2022 Kampala</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Fri, 01 Jul 2022 03:12:06 +0000</pubDate>
      <link>https://dev.to/rukundob451/google-io-extended-2022-kampala-45d7</link>
      <guid>https://dev.to/rukundob451/google-io-extended-2022-kampala-45d7</guid>
      <description>&lt;p&gt;Google I/O Extended is an annual developer event that takes place in different cities around the world held by local Google Developer Groups as an extended version of the main I/O conference in San Francisco.&lt;/p&gt;

&lt;p&gt;The Google Developer Groups in Uganda in partnership with GDSC Makerere University hosted this year's event in Kampala on 25th June at MoTIV Uganda.  The event was graced by a number of junior and senior developers including designers.&lt;/p&gt;

&lt;p&gt;Each year we expect highly technical and in-depth sessions on advancing and emerging technologies in the different branches of tech from different experts in the field and the I/O Extended event provided this and so much more.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/sopio/"&gt;1. Solomon Opio&lt;/a&gt;, the leader of GDG  and Tech Community lead at The Innovation Village flagged off the event, who briefly talked about Angular and Firebase technologies that were later explained in detail by the guest speakers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1VEppB9D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c02ndm72uem783mny3fq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1VEppB9D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c02ndm72uem783mny3fq.jpg" alt="Image description" width="880" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Google has added a number of exciting features and updates to its products. some of the features that stood out to me include;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding more remote and rural areas to the Google maps.&lt;/li&gt;
&lt;li&gt;Have more natural conversations with Google Assistant&lt;/li&gt;
&lt;li&gt;Introduction of lambda 2 which is an advancement to Natural Language Processing and conversational capabilities between computers and people.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We were graced by two remarkable guest speakers who provided technical details on different technologies.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://www.linkedin.com/in/habib-sentongo-0887a3133/"&gt;2. Habib Sentongo&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;He talked about the state of Angular which is a web framework designed to support developers as they build scalable performance web applications where there is scaling your product as user demand increases or scaling your team to meet the growing technical needs Angular has been there for you and your teams. &lt;/p&gt;

&lt;p&gt;Apps are now powered by the more efficient &lt;a href="https://docs.angular.lat/guide/ivy"&gt;Ivy Engine&lt;/a&gt; which has improved type checking and error reporting, better debugging, smaller bundle sizes and more.&lt;/p&gt;

&lt;p&gt;Getting Started with Angular has been improved through its documentation that has been made easy and simpler for developers getting started with learning the framework, API's and more useful Angular concepts. Check out the Docs &lt;a href="https://angular.io/docs"&gt;Angular Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---4N3sJmm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2d6ee7j67u1zq6z8whzx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---4N3sJmm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2d6ee7j67u1zq6z8whzx.jpg" alt="Image description" width="880" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://www.linkedin.com/in/kigenyi-phillip-461778101/"&gt;2. Phillip Kigenyi&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;He talked about Firebase used for building apps and games developers love has been improved strengthening its integration with Google's most popular products and making their platform work better with the most popular developer ecosystem.&lt;br&gt;
Extension events which is a great way for quickly adding features to your app with little to no code and has been made more customizable including extensions for marketing and payments. &lt;/p&gt;

&lt;p&gt;Firebase hosting helps deploy your modern web applications faster and in a modern developer preview, you can deploy your firebase powered web applications built using Next js or Angular universal with a single deploy command.&lt;/p&gt;

&lt;p&gt;Flutter and firebase integration which has been improved by greatly reducing the number of steps it takes to get started and no longer requiring to use any platform specific Integrated Development Environments(IDE's). Check out the official Docs &lt;a href="https://firebase.google.com/docs?gclid=CjwKCAjwzeqVBhAoEiwAOrEmzX6WuMdCAc8a7raoRtyNCWm1Glis0VJm5LUZKPhte9o-q6-rMR381xoCho8QAvD_BwE&amp;amp;gclsrc=aw.ds"&gt;Firebase&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Overall, the Google IO Extended 2022 event was a great and insightful experience and I look forward to more from Google come 2023.&lt;br&gt;
A few pictures to highlight the event.&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/rukundob451"&gt;github&lt;/a&gt; and  &lt;a href="https://twitter.com/benja_rukundo"&gt;Twitter&lt;/a&gt; thank you.&lt;/p&gt;

</description>
      <category>googleio2022</category>
      <category>ioextended22</category>
      <category>womenintech</category>
    </item>
    <item>
      <title>this keyword</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Mon, 27 Jun 2022 18:14:22 +0000</pubDate>
      <link>https://dev.to/rukundob451/this-keyword-2a88</link>
      <guid>https://dev.to/rukundob451/this-keyword-2a88</guid>
      <description>&lt;p&gt;Save post&lt;/p&gt;

&lt;p&gt;Add Subtitle&lt;/p&gt;

&lt;p&gt;this keyword in java [#3]&lt;/p&gt;

&lt;p&gt;Write&lt;/p&gt;

&lt;p&gt;Preview&lt;/p&gt;

&lt;p&gt;Guide&lt;/p&gt;

&lt;h3&gt;
  
  
  Recap
&lt;/h3&gt;

&lt;p&gt;In the previous articles, we discussed what Object-Oriented Programming is, objects, classes and respective constructors as well as how to access members of a class.&lt;br&gt;
We also saw examples of these concepts in the previous two articles;&lt;/p&gt;

&lt;p&gt;Today, we shall look at the "this" keyword in java and why it useful&lt;/p&gt;
&lt;h4&gt;
  
  
  this keyword
&lt;/h4&gt;

&lt;p&gt;In java, this keyword is used to refer to the current object inside a method or also a constructor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Animal {
    int instanceVariable;

    Animal(int instanceVariable) {
          this.instanceVariable = instVariable;
          System.out.println("the this reference =" + this);
   }

public static void main(String[] args) {
      Animal age = new Animal(7);
      System.out.println("the object reference =" + age);
       }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Output:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;the this reference = Animal@78gd345f
the object reference = Animal@78gd345f
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example above, the object we created named age of the class Animal and once we print the reference to the object and this keyword of the class.&lt;br&gt;
In this, we see that the reference of both age and this is the same meaning this is nothing but the reference to the current object.&lt;/p&gt;
&lt;h3&gt;
  
  
  Use of the this keyword
&lt;/h3&gt;
&lt;h4&gt;
  
  
  1. Ambiguity variable names
&lt;/h4&gt;

&lt;p&gt;Not only in Java but also other programming languages, it is not allowed to declare two or more variables having the same name inside a scope that is class or method. But however instance variables and parameters may have the same name without using the "this" keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Exam {
    // instance variable
    int tm;

    // parameter
    Exam(int tm){
              tm =  tm;
    }

     public static void main(String[] args) {
               Exam examOne = new Exam(3);
               System.out.println("examOne.tm = " examOne.tm);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Output:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;examOne.tm = 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example above, we have passed 3 to the constructor but we are getting 0 as an output and this is because the Java compiler is getting confused because of the ambiguity in names between instance the variable and the parameter.&lt;/p&gt;

&lt;p&gt;Rewriting the above code with the this keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Exam {

    int tm;
    Exam(int tm){
        this.tm = tm;
    }

    public static void main(String[] args) {
        Exam oj = new Exam(3);
        System.out.println("oj.tm = " + oj.tm);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Output:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;oj.tm = 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case above, we are getting the expected output. This is because when the constructor is called, this inside the constructor is replaced by the object oj that has called the constructor. Hence the tm variable is assigned value 3.&lt;/p&gt;

&lt;p&gt;Also, if the name of the parameter and instance variable is different, the compiler will automatically append the this keyword. For example the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Exam {
    int size;

    Exam(int p) {
        size = p;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is equivalent to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Exam {
    int size;

    Exam(int p) {
        this.size = p;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  This with Getters and Setters
&lt;/h3&gt;

&lt;p&gt;Another common use of this keyword is in setters and getters methods of a class. For example:&lt;br&gt;
&lt;/p&gt;

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

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

   // getter method
   String getName(){
       return this.name;
   }

   public static void main( String[] args ) {
       Main obj = new Main();

       // calling the setter and the getter method
       obj.setName("Toshiba");
       System.out.println("obj.name: "+obj.getName());
   }
}
&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;obj.name: Toshiba
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we have used this keyword:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to assign value inside the setter method&lt;/li&gt;
&lt;li&gt;to access value inside the getter method&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the huge advantages of this() is to reduce the amount of duplicate code. However, we should be always careful while using this().&lt;/p&gt;

&lt;p&gt;This is because calling constructor from another constructor adds overhead and it is a slow process. Another huge advantage of using this() is to reduce the amount of duplicate code.&lt;/p&gt;

&lt;p&gt;Note: Invoking one constructor from another constructor is called explicit constructor invocation.&lt;/p&gt;

&lt;h4&gt;
  
  
  Passing this as an Argument
&lt;/h4&gt;

&lt;p&gt;We can use this keyword to pass the current object as an argument to a method. For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class ThisExample {
    // declare variables
    int x;
    int y;

    ThisExample(int x, int y) {
       // assign values of variables inside constructor
        this.x = x;
        this.y = y;

        // value of x and y before calling add()
        System.out.println("Before passing this to addTwo() method:");
        System.out.println("x = " + this.x + ", y = " + this.y);

        // call the add() method passing this as argument
        add(this);

        // value of x and y after calling add()
        System.out.println("After passing this to addTwo() method:");
        System.out.println("x = " + this.x + ", y = " + this.y);
    }

    void add(ThisExample o){
        o.x += 2;
        o.y += 2;
    }
}

class Main {
    public static void main( String[] args ) {
        ThisExample obj = new ThisExample(1, -2);
    }
}
&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;Before passing this to addTwo() method:
x = 1, y = -2
After passing this to addTwo() method:
x = 3, y = 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, inside the constructor ThisExample(), notice the line,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add(this);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we are calling the add() method by passing this as an argument. Since this keyword contains the reference to the object obj of the class, we can change the value of x and y inside the add() method.&lt;/p&gt;

&lt;p&gt;For a further and more deep explanation about Object Oriented Programming, check out this wonderful playlist.&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=enI_KyGLYPo"&gt;Object Oriented Programming in Java&lt;/a&gt; by &lt;em&gt;Kunal Kushwaha&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/rukundob451"&gt;github&lt;/a&gt; and  &lt;a href="https://twitter.com/benja_rukundo"&gt;Twitter&lt;/a&gt; thank you.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>java</category>
      <category>oop</category>
      <category>this</category>
    </item>
    <item>
      <title>Java and Object Oriented Programming [#2]</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Mon, 20 Jun 2022 09:09:51 +0000</pubDate>
      <link>https://dev.to/rukundob451/java-and-object-oriented-programming-2-2aj0</link>
      <guid>https://dev.to/rukundob451/java-and-object-oriented-programming-2-2aj0</guid>
      <description>&lt;h4&gt;
  
  
  Recap
&lt;/h4&gt;

&lt;p&gt;In the previous article, we discussed Object-Oriented Programming, objects, and classes, as well as how to access members of a class. We also saw examples of these concepts in the first article. &lt;a href="https://dev.to/rukundob451/java-and-object-oriented-programming-1-4n74"&gt;Check out that article #1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In today's article, we are going to look at Constructors, their types and how to use them. This will be backed by examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a Constructor?
&lt;/h3&gt;

&lt;p&gt;A constructor in Java is similar to a method that is invoked when an object of the class is created.&lt;/p&gt;

&lt;p&gt;Specifically, a constructor has the same name as that of the class and does not have any return type. &lt;br&gt;
&lt;a href="https://stackoverflow.com/questions/1788312/why-do-constructors-not-return-values"&gt;Why constructors don't have return types&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;An example to demonstrate this;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Exam {
    Exam() {
       // Constructor body
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the Exam() is the constructor and it has the same name as that of the class and no return type.&lt;/p&gt;

&lt;p&gt;NB: By default, there is a constructor when a class is created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Exam {
  private String name;

  // constructor
  Exam() {
    System.out.println("The constructor is called:");
    type = "Computer";
  }

  public static void main(String[] args) {

    // constructor is invoked while
    // creating an object of the Main class
    Exam obj = new Exam();
    System.out.println("The type is " + obj.type);
  }
}
&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;The constructor is called:
The type is Computer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above demonstration, the constructor we created is Exam() and inside it we are initializing the value of the type variable.&lt;br&gt;
Take note of the creation an object for the Exam class&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Exam obj = new Exam();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The value of the type variable is initialized and the program prints the value of the type variables as Computer.&lt;/p&gt;



&lt;h2&gt;
  
  
  Types of Constructors
&lt;/h2&gt;

&lt;p&gt;There are three types of Constructors:&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Java No-Arg Constructors
&lt;/h3&gt;

&lt;p&gt;A Java constructor, like methods, may or may not contain any parameters (arguments).&lt;/p&gt;

&lt;p&gt;A constructor is known as a no-argument constructor if it does not accept any parameters. &lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Constructor() {
    // body of the constructor
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Exam {

  int i;

  // constructor with no parameter
  private Exam() {
    i = 5;
    System.out.println("Constructor is called");
  }

  public static void main(String[] args) {

    // calling the constructor without any parameter
    Exam obj = new Exam();
    System.out.println("Value of i: " + obj.i);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Output:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Constructor is called
Value of i: 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, we have created a constructor Exam().&lt;br&gt;
The constructor is referred to as a no-arg constructor because it does not accept any parameters.&lt;/p&gt;

&lt;p&gt;It's also worth noting that the constructor has been declared private, meaning it can't be accessed from outside the class. Therefore creating objects from outside the class is prohibited using the private constructor.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Parameterized Constructor
&lt;/h3&gt;

&lt;p&gt;A Java constructor can also accept one or more parameters. Such constructors are known as parameterized constructors&lt;br&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;class Exam {

  String languages;

  // constructor accepting single value
  Exam(String lang) {
    languages = lang;
    System.out.println(languages + " Programming Language");
  }

  public static void main(String[] args) {

    // call constructor by passing a single value
    Exam obj1 = new Exam("Java");
    Exam obj2 = new Exam("Python");
    Exam obj3 = new Exam("C");
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Output:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Java Programming Language
Python Programming Language
C Programming Language
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the constructor named Main() takes a single parameter.&lt;br&gt;
Therefore the expression passes a single value to the constructor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Exam obj1 = new Exam("Java");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Java Default Constructor
&lt;/h3&gt;

&lt;p&gt;When we don't create a constructor, the Java compiler automatically creates a no-arg constructor during the execution of the program, thus the default constructor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Exam {

  int a;
  boolean b;

  public static void main(String[] args) {

    // A default constructor is called
    Exam obj = new Exam();

    System.out.println("Default Value:");
    System.out.println("a = " + obj.a);
    System.out.println("b = " + obj.b);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Output:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a = 0
b = false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, we haven't created any constructors. As a result, the java compiler creates the default constructor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Java Constructor Overloading
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Exam {

  String language;

  // constructor with no parameter
  Exam() {
    this.language = "Java";
  }

  // constructor with a single parameter
  Exam(String language) {
    this.language = language;
  }

  public void getName() {
    System.out.println("Programming Langauage: " + this.language);
  }

  public static void main(String[] args) {

    // call constructor with no parameter
    Exam obj1 = new Exam();

    // call constructor with a single parameter
    Exam obj2 = new Exam("Python");

      obj1.getName();
      obj2.getName();
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Output:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Programming Language: Java
Programming Language: Python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, we have two constructors in these examples: Exam() and Exam(String language). Here both the constructor initialize the value of the variable language with different values.&lt;/p&gt;

&lt;p&gt;NB: We have used &lt;em&gt;this&lt;/em&gt; keyword to specify the variable of the class. Read more &lt;a href="https://www.programiz.com/java-programming/this-keyword"&gt;about&lt;/a&gt; this keyword.&lt;/p&gt;

&lt;p&gt;For a further and more deep explanation about Object Oriented Programming, check out this wonderful playlist.&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=enI_KyGLYPo"&gt;Object Oriented Programming in Java&lt;/a&gt; by &lt;em&gt;Kunal Kushwaha&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/rukundob451"&gt;github&lt;/a&gt; and  &lt;a href="https://twitter.com/benja_rukundo"&gt;Twitter&lt;/a&gt; thank you.&lt;/p&gt;

</description>
      <category>java</category>
      <category>oop</category>
      <category>beginners</category>
      <category>constructors</category>
    </item>
    <item>
      <title>Java and Object Oriented Programming [#1]</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Mon, 13 Jun 2022 03:49:10 +0000</pubDate>
      <link>https://dev.to/rukundob451/java-and-object-oriented-programming-1-4n74</link>
      <guid>https://dev.to/rukundob451/java-and-object-oriented-programming-1-4n74</guid>
      <description>&lt;h3&gt;
  
  
  What is Object Oriented Programming(OOP)?
&lt;/h3&gt;

&lt;p&gt;This is a programming paradigm based on the concept of objects, which can contain data and code which data is in the form of fields also known as attributes or properties and code in the form of procedures also known as methods.&lt;/p&gt;

&lt;p&gt;Many of the most widely used programming languages such as C++, Javascript and Python namely but a few implement Object Oriented Programming other than Java.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are Objects?
&lt;/h3&gt;

&lt;p&gt;Objects are always called instances of a class and has a state and behavior. For example, a dog is an object that has&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;State: name, breed, color etc&lt;/li&gt;
&lt;li&gt;Behaviors: barking, running, sleeping etc&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Class
&lt;/h3&gt;

&lt;p&gt;A class in java is a blueprint for the object and before we create an object we first need to define the class. &lt;/p&gt;

&lt;p&gt;Think of the class a sketch(prototype) of a house and it contains all details about the windows, floors, doors and the others. Based on these descriptions we build the house and therefor the House is the object.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;NB: Many different houses can be made based on the same description of the class.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a class in Java
&lt;/h3&gt;

&lt;p&gt;We can create a class in Java using the class keyword. Such as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class className {
    // fields
    // nethods
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this, the fields and methods represent the state and behavior of the object respectively.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fields are used to store data &lt;/li&gt;
&lt;li&gt;methods are used to perform some operations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our car object we can create the class&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Car {
    // state or field
    String name;
    int manufacturer;
    String color;

    // behavior or method
    void braking() {
        System.out.println("Car is braking");
   }

   void speeding() {
        System.out.println("Car is speeding");
   }
}

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the above example, we have created a class named Car which has fields name, manufacturer, color and methods braking(), speeding().&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Car is a prototype and now we can create any number of cars using the prototype. All the bicycles will share the fields and methods of the prototype.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Java Objects
&lt;/h3&gt;

&lt;p&gt;An object is an instance of a class. Our class we created called Car then sportsCar, suvCar and f1Car can be considered as the objects of that class.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating an Object in Java
&lt;/h3&gt;

&lt;p&gt;This is how an object of a class is created in java&lt;br&gt;
&lt;/p&gt;

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

// for Car class
Car sportsCar = new Car();

Car suvCar = new Car();

// sportsCar and suvCar are the names of the objects.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's observe the use of the &lt;em&gt;new&lt;/em&gt; keyword along with the constructor of the class to create an object. Constructors are almost the same as methods and use the same name as the class only that it doesn't have a return type. for example;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Car {
    Car() {
    // constructor body
 }
}

// Car() is a constructor and doesn't have a return type
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Access Members of a class
&lt;/h3&gt;

&lt;p&gt;The name of the object is along with . (the dot operator) we can be able to access the members of a class. For example;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Car {
    // state or field
    String name;
    int manufacturer;
    String color;

    // behavior or method
    void braking() {
        System.out.println("Car is braking");
   }

   void speeding() {
        System.out.println("Car is speeding");
   }
}

// create object named suvCar
Car suvCar = new Car();

// access fields
suvCar.name;
suvCar.maufacturer;

// access methods
suvCar.speeding();

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

&lt;/div&gt;



&lt;p&gt;Here you can be able to access the fields and methods of this class.&lt;/p&gt;

&lt;p&gt;We are now able to understand what a class is and an object. Let's look at a fully working example;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Lamp {

  // stores the value for light
  // true if light is on
  // false if light is off
  boolean isOn;

  // method to turn on the light
  void turnOn() {
    isOn = true;
    System.out.println("Light on? " + isOn);

  }

  // method to turnoff the light
  void turnOff() {
    isOn = false;
    System.out.println("Light on? " + isOn);
  }
}

class Main {
  public static void main(String[] args) {

    // create objects led and halogen
    Lamp led = new Lamp();
    Lamp halogen = new Lamp();

    // turn on the light by
    // calling method turnOn()
    led.turnOn();

    // turn off the light by
    // calling method turnOff()
    halogen.turnOff();
  }
}
&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;Light on? true
Light on? false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In our next part we are going to look at methods, overloading and constructors. &lt;br&gt;
Later we shall look into concepts like abstraction, encapsulation, inheritance and polymorphism.&lt;/p&gt;

&lt;p&gt;For a further and more deep explanation about Object Oriented Programming, check out this wonderful playlist.&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=enI_KyGLYPo"&gt;Object Oriented Programming in Java&lt;/a&gt; by &lt;em&gt;Kunal Kushwaha&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/"&gt;Linkedin&lt;/a&gt;, &lt;a href="https://github.com/rukundob451"&gt;github&lt;/a&gt; and  &lt;a href="https://twitter.com/benja_rukundo"&gt;Twitter&lt;/a&gt; thank you.&lt;/p&gt;

</description>
      <category>dsa</category>
      <category>java</category>
      <category>oop</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Binary Search</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Mon, 06 Jun 2022 03:09:48 +0000</pubDate>
      <link>https://dev.to/rukundob451/binary-search-42a</link>
      <guid>https://dev.to/rukundob451/binary-search-42a</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;As we saw previously, we looked at the linear search and how it is able to find a target element by iterating over each and every element in the array &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Well, binary search is the second most fundamental search algorithm after linear search. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NB:&lt;/strong&gt; While in linear search we have to find each element from an array by checking each and every element of this array. This means we have to continue iterating over every element until we find the element we are searching for or until we have reached the dead-end of the array.&lt;/p&gt;

&lt;h4&gt;
  
  
  Algorithm:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    arr = [2, 4, 6, 9, 11, 12, 14, 20, 36, 48] (Sorted array)
    target = 36
1. Find the middle element
2. Check:
    If target &amp;gt; middle =&amp;gt; search in right else =&amp;gt; search in left
3. if target == middle =&amp;gt; we found element
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gicMwJHT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0z3dnf26g4rhzhurq11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gicMwJHT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0z3dnf26g4rhzhurq11.png" alt="Binary Search Example" width="707" height="610"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, the space in which we are searching is getting divided into spaces.&lt;/p&gt;

&lt;h4&gt;
  
  
  Time complexity:
&lt;/h4&gt;

&lt;p&gt;Best case: O(1)&lt;br&gt;
Worst case: O(logn)&lt;/p&gt;

&lt;h4&gt;
  
  
  Explanation: find the maximum number of comparisons
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C8sXDTtY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ilwr4zznxn4y2mj7dm0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C8sXDTtY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ilwr4zznxn4y2mj7dm0.png" alt="Image description" width="595" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  =&amp;gt; Order agnostic Binary search
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Let's say if we don't know that the array is sorted in ascending or descending order.&lt;/p&gt;

&lt;p&gt;arr = [90, 75, 18, 12, 6, 4, 3, 1]&lt;br&gt;
target = 75&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here, target &amp;gt; middle =&amp;gt; search in left&lt;/p&gt;

&lt;p&gt;Here, start &amp;gt; end -&amp;gt; Descending order&lt;br&gt;
       90 &amp;gt; 1&lt;br&gt;
when start &amp;lt; end -&amp;gt; Ascending order&lt;/p&gt;

&lt;p&gt;For further explanation about Binary search algorithm, kindly check out this wonderful toturial.&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=enI_KyGLYPo"&gt;Binary Search in Java&lt;/a&gt; by &lt;em&gt;Kunal Kushwaha&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://github.com/rukundob451"&gt;github&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/"&gt;Linkedin&lt;/a&gt;, thank you.&lt;/p&gt;

</description>
      <category>dsa</category>
      <category>java</category>
      <category>algorithms</category>
      <category>search</category>
    </item>
    <item>
      <title>Linear Search</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Mon, 30 May 2022 06:18:34 +0000</pubDate>
      <link>https://dev.to/rukundob451/linear-search-2ljf</link>
      <guid>https://dev.to/rukundob451/linear-search-2ljf</guid>
      <description>&lt;p&gt;&lt;strong&gt;Searching&lt;/strong&gt;&lt;br&gt;
In programming it is a process of finding a given value position in a list of values. In our daily life it plays such an important role this can be finding something from a collection of data, you may need to find a word from a dictionary or find your friend from the crowd.&lt;/p&gt;
&lt;h4&gt;
  
  
  Linear/Sequential search
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;It is the basic simple search algorithm&lt;/li&gt;
&lt;li&gt;In sequential search, we compare the target value with all the other elements given in the list.
for example
arr = {18, 12, 19, 77, 29, 50} (unsorted array)
target = 77&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the above example, the target value is compared with all the elements in the array in sequential/linear way.&lt;/p&gt;
&lt;h4&gt;
  
  
  Time Complexity:
&lt;/h4&gt;
&lt;h5&gt;
  
  
  Best Case: O(1) -&amp;gt; constant
&lt;/h5&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;How many checks will the loop make in the best case i.e the element will be found at the 0th index that is only one comparison will be made for best case.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Worst Case: O(n)
&lt;/h4&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Worst case, here it will go through every element and then it says element not found
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h8sTz6LL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oova8w3jowivo34qcvld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h8sTz6LL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oova8w3jowivo34qcvld.png" alt="Image description" width="880" height="302"&gt;&lt;/a&gt;&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) {
        int[] nums = {23, 45, 1, 2, 8, 19, -3, 16, -11, 28};
        int target = 19;
        int ans = linearSearch(nums, target);
        System.out.println(ans);
    }
     // search in the array: return the index if item found
    // otherwise if item not found return -1
    static int linearSearch(int[] arr, int target) {
        if (arr.length == 0) {
            return -1;
        }

        // run a for loop
        for (int index = 0; index &amp;lt; arr.length; index++) {
            // check for element at every index if it is = target
            int element = arr[index];
            if (element == target) {
                return index;
            }
        }
        // this line will execute if none of the return statements above have executed
        // hence the target not found
        return -1;
    }

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

&lt;/div&gt;



&lt;p&gt;Solved my first leetcode question with linear search check it out &lt;a href="https://leetcode.com/problems/find-numbers-with-even-number-of-digits/submissions/"&gt;Even number of digits&lt;/a&gt;&lt;br&gt;
For further explanation about linear search algorithm, kindly check out this wonderful toturial&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=_HRA37X8N_Q"&gt;Linear Search in Java&lt;/a&gt; by &lt;em&gt;Kunal Kushwaha&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://github.com/rukundob451"&gt;github&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/"&gt;Linkedin&lt;/a&gt;, thank you.&lt;/p&gt;

</description>
      <category>dsa</category>
      <category>search</category>
      <category>algorithms</category>
      <category>java</category>
    </item>
    <item>
      <title>Cooking up something</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Mon, 02 May 2022 10:00:50 +0000</pubDate>
      <link>https://dev.to/rukundob451/cooking-up-something-lbg</link>
      <guid>https://dev.to/rukundob451/cooking-up-something-lbg</guid>
      <description>&lt;p&gt;Hello there, been off for a while without posting articles of late got a little fixed here and there but also been cooking up something too.&lt;br&gt;
Happy new month to you. &lt;/p&gt;

</description>
      <category>may</category>
      <category>newmonth</category>
      <category>lost</category>
      <category>cookingupsth</category>
    </item>
    <item>
      <title>Functions/Methods in Java</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Mon, 13 Dec 2021 01:31:41 +0000</pubDate>
      <link>https://dev.to/rukundob451/functionsmethods-2p4i</link>
      <guid>https://dev.to/rukundob451/functionsmethods-2p4i</guid>
      <description>&lt;h3&gt;
  
  
  What are java functions/methods?
&lt;/h3&gt;

&lt;p&gt;A function is a block of code which only runs when it is called.&lt;/p&gt;

&lt;p&gt;To reuse code: &lt;em&gt;define the once and use it many times&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  General Syntax:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Main {
    static void nameOfMethod() {
    // code
  }
}
&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;public class Main{
    access-modifier return-type method() {
     // code
     return statement;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;method() - name of calling function&lt;br&gt;
return-type - A statement that causes the program control to transfer back to the caller of a method.&lt;br&gt;
A return type may be a primitive type like int, flaot or void type(returns nothing)&lt;/p&gt;
&lt;h4&gt;
  
  
  Note: These are the few important things to understand about returning the values;
&lt;/h4&gt;

&lt;p&gt;The type of data returned by a method must be compatible with the return type specified by the method for example if return type of some method is boolean, we can not return an integer&lt;/p&gt;

&lt;p&gt;The variable receiving the value returned by a method must also be compatible with the return type specified for the method.&lt;/p&gt;

&lt;p&gt;=&amp;gt; Pass by value:&lt;br&gt;
example 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main() {
   name = a 
   greet(name);
}
static void greet(naam) {
    print(naam);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  primitive data type like int, short, char, byte etc.(just pass value)
&lt;/h5&gt;

&lt;h5&gt;
  
  
  object of reference: passing value of reference variable
&lt;/h5&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psvm() {
    a = 10;
    b =20;
    swap(a, b);
}
swap(num1, num2) {
    temp = num1;
    num1 = num2;
    num2 = temp;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Scopes:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;function scope: Variables declared inside a method/function scope(means inside the method) can't be accessed outside the method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;block scope: Variables initialized outside the block can be updated inside the block&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;loop scope: Variables declared inside loop are having loop scope.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;shadowing: Shadowing is the practice in Java is the practice of using variables in overlapping scopes with the same name where the variable in low-level scope overrides the variable of high-level scope. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Method/Function overloading: This happens when two functions have the same name.&lt;br&gt;
This is allowed having different arguments with same method name.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a more detailed introduction to java programming, I would surely encourage you to check out this wonderful toturial&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=vvanI8NRlSI&amp;amp;list=PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ&amp;amp;index=7"&gt;Functions/Methods in Java&lt;/a&gt; by &lt;em&gt;Kunal Kushwaha&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://github.com/rukundob451"&gt;github&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/"&gt;Linkedin&lt;/a&gt;, thank you.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Java Switch Statements</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Tue, 12 Oct 2021 20:02:45 +0000</pubDate>
      <link>https://dev.to/rukundob451/java-switch-statements-4fh0</link>
      <guid>https://dev.to/rukundob451/java-switch-statements-4fh0</guid>
      <description>&lt;h3&gt;
  
  
  What are java statements?
&lt;/h3&gt;

&lt;p&gt;Use the switch statement to select one of many code blocks to be executed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;switch(expression) {
  case x:
    // code block
    break;
  case y:
    // code block
    break;
  default:
    // code block
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  How does it work?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The switch expression is evaluated once.&lt;/li&gt;
&lt;li&gt;The value of the expression is compared with the values of each case.&lt;/li&gt;
&lt;li&gt;If there is a match, the associated block of code is executed.&lt;/li&gt;
&lt;li&gt;The break and default keywords are optional, and will be described later in this chapter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The example below uses the weekday number to calculate the weekday name:&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int day = 4;
switch (day) {
  case 1:
    System.out.println("Monday");
    break;
  case 2:
    System.out.println("Tuesday");
    break;
  case 3:
    System.out.println("Wednesday");
    break;
  case 4:
    System.out.println("Thursday");
    break;
  case 5:
    System.out.println("Friday");
    break;
  case 6:
    System.out.println("Saturday");
    break;
  case 7:
    System.out.println("Sunday");
    break;
}
// Outputs "Thursday" (day 4)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The break Keyword
&lt;/h3&gt;

&lt;p&gt;When Java reaches a &lt;em&gt;break&lt;/em&gt; keyword, it breaks out of the switch block.&lt;/p&gt;

&lt;p&gt;This will stop the execution of more code and case testing inside the block.&lt;/p&gt;

&lt;p&gt;When a match is found, and the job is done, it's time for a break. There is no need for more testing.&lt;/p&gt;

&lt;p&gt;A break can save a lot of execution time because it "ignores" the execution of all the rest of the code in the switch block.&lt;/p&gt;

&lt;h3&gt;
  
  
  The default Keyword
&lt;/h3&gt;

&lt;p&gt;The default keyword specifies some code to run if there is no case match:&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int day = 4;
switch (day) {
  case 6:
    System.out.println("Today is Saturday");
    break;
  case 7:
    System.out.println("Today is Sunday");
    break;
  default:
    System.out.println("Looking forward to the Weekend");
}
// Outputs "Looking forward to the Weekend"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Note that if the default statement is used as the last statement in a switch block, it does not need a break.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a more detailed introduction to java programming, I would surely encourage you to check out this wonderful toturial&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=mA23x39DjbI&amp;amp;list=PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ&amp;amp;index=6&amp;amp;t=569s"&gt;Switch Statements + Nested Case in Java&lt;/a&gt; by &lt;em&gt;Kunal Kushwaha&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://github.com/rukundob451"&gt;github&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/"&gt;Linkedin&lt;/a&gt;, thank you.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>opensource</category>
      <category>dsa</category>
    </item>
    <item>
      <title>Introduction to Control Flow in Java</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Thu, 07 Oct 2021 03:35:31 +0000</pubDate>
      <link>https://dev.to/rukundob451/introduction-to-control-flow-in-java-42p9</link>
      <guid>https://dev.to/rukundob451/introduction-to-control-flow-in-java-42p9</guid>
      <description>&lt;h3&gt;
  
  
  What is Control Flow?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A program's control flow is the order in which the program's code executes thus the use of control flow in a Java program being crucial.&lt;/li&gt;
&lt;li&gt;The control flow in a Java program is regulated by conditional statements and loops.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Java supports the usual logical conditions from mathematics:
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Less than: a &amp;lt; b&lt;/li&gt;
&lt;li&gt;Less than or equal to: a &amp;lt;= b&lt;/li&gt;
&lt;li&gt;Greater than: a &amp;gt; b&lt;/li&gt;
&lt;li&gt;Greater than or equal to: a &amp;gt;= b&lt;/li&gt;
&lt;li&gt;Equal to a == b&lt;/li&gt;
&lt;li&gt;Not Equal to: a != b
You can use these conditions to perform different actions for different decisions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Java has the following conditional statements:
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Use if to specify a block of code to be executed, if a specified condition is true&lt;/li&gt;
&lt;li&gt;Use else to specify a block of code to be executed, if the same condition is false&lt;/li&gt;
&lt;li&gt;Use else if to specify a new condition to test, if the first condition is false&lt;/li&gt;
&lt;li&gt;Use switch to specify many alternative blocks of code to be executed&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The if Statement
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use the if statement to specify a block of Java code to be executed if a condition is true.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Syntax:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (condition) {
  // block of code to be executed if the condition is true
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that if is in lowercase letters. Uppercase letters (If or IF) will generate an error.&lt;/p&gt;

&lt;p&gt;In the example below, we test two values to find out if 20 is greater than 18. If the condition is true, print some text:&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (20 &amp;gt; 18) {
  System.out.println("20 is greater than 18");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also test variables:&lt;/p&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int x = 20;
int y = 18;
if (x &amp;gt; y) {
  System.out.println("x is greater than y");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The else Statement
&lt;/h3&gt;

&lt;p&gt;Use the else statement to specify a block of code to be executed if the condition is false.&lt;/p&gt;

&lt;h4&gt;
  
  
  Syntax:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (condition) {
  // block of code to be executed if the condition is true
} else {
  // block of code to be executed if the condition is false
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int time = 20;
if (time &amp;lt; 18) {
  System.out.println("Good day.");
} else {
  System.out.println("Good evening.");
}
// Outputs "Good evening."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The else if Statement
&lt;/h3&gt;

&lt;p&gt;Use the else if statement to specify a new condition if the first condition is false.&lt;/p&gt;

&lt;h4&gt;
  
  
  Syntax:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (condition1) {
  // block of code to be executed if condition1 is true
} else if (condition2) {
  // block of code to be executed if the condition1 is false and condition2 is true
} else {
  // block of code to be executed if the condition1 is false and condition2 is false
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int time = 22;
if (time &amp;lt; 10) {
  System.out.println("Good morning.");
} else if (time &amp;lt; 20) {
  System.out.println("Good day.");
} else {
  System.out.println("Good evening.");
}
// Outputs "Good evening."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Short Hand If...Else (Ternary Operator):
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;There is also a short-hand if else, which is known as the ternary operator because it consists of three operands. &lt;/li&gt;
&lt;li&gt;It can be used to replace multiple lines of code with a single line. It is often used to replace simple if else statements:&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Syntax:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;variable = (condition) ? expressionTrue :  expressionFalse;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Instead of writing:&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int time = 20;
if (time &amp;lt; 18) {
  System.out.println("Good day.");
} else {
  System.out.println("Good evening.");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You can simply write:&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Example:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int time = 20;
String result = (time &amp;lt; 18) ? "Good day." : "Good evening.";
System.out.println(result);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a more detailed introduction to java programming, I would surely encourage you to check out this wonderful toturial &lt;a href="https://www.youtube.com/watch?v=ldYLYRNaucM&amp;amp;list=PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ&amp;amp;index=5"&gt;Conditionals and Loops + Calculator Program&lt;/a&gt; by &lt;em&gt;Kunal Kushwaha&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://github.com/rukundob451"&gt;github&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/"&gt;linkedin&lt;/a&gt;, thank you.&lt;/p&gt;

&lt;p&gt;Splendid week to you'll&lt;/p&gt;

</description>
      <category>java</category>
      <category>progamming</category>
      <category>opensource</category>
      <category>dsa</category>
    </item>
    <item>
      <title>Introduction to Java</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Sat, 02 Oct 2021 02:05:10 +0000</pubDate>
      <link>https://dev.to/rukundob451/introduction-to-java-5nj</link>
      <guid>https://dev.to/rukundob451/introduction-to-java-5nj</guid>
      <description>&lt;p&gt;&lt;a href="https://media.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%2Fs69jvxcme5m2bxnb77ur.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fs69jvxcme5m2bxnb77ur.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Java?
&lt;/h3&gt;

&lt;p&gt;Java is a popular programming language, created in 1995.&lt;/p&gt;

&lt;p&gt;It is owned by Oracle, and more than 3 billion devices run Java.&lt;/p&gt;

&lt;p&gt;It is used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mobile applications (specially Android apps)&lt;/li&gt;
&lt;li&gt;Desktop applications&lt;/li&gt;
&lt;li&gt;Web applications&lt;/li&gt;
&lt;li&gt;Web servers and application servers&lt;/li&gt;
&lt;li&gt;Games&lt;/li&gt;
&lt;li&gt;Database connection and much more &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why Use Java?
&lt;/h3&gt;

&lt;p&gt;Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) and thus platform independent.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is one of the most popular programming language in the world&lt;/li&gt;
&lt;li&gt;It is easy to learn and simple to use&lt;/li&gt;
&lt;li&gt;It is open-source and free&lt;/li&gt;
&lt;li&gt;It is secure, fast and powerful&lt;/li&gt;
&lt;li&gt;It has a huge community support (tens of millions of developers)&lt;/li&gt;
&lt;li&gt;Java is an object oriented language which gives a clear structure to programs and allows code to be reused, lowering development costs&lt;/li&gt;
&lt;li&gt;As Java is close to C++ and C#, it makes it easy for programmers to switch to Java or vice versa&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How to get started
&lt;/h3&gt;

&lt;p&gt;I would surely advice you to first downloading the Java Development Kit(jdk) from the official Oracle website &lt;a href="https://www.oracle.com/java/technologies/downloads/#jdk17-windows" rel="noopener noreferrer"&gt;here&lt;/a&gt; dependent on your system whether linux, Macos or Windows.&lt;/p&gt;

&lt;p&gt;Next, I would download an Integrated Development Environment(IDE). They are a tone of IDE's out there but I would surely recommend Intellij IDE made by JetBrains due to a number of reasons here and there, you can download the Intellij community edition from &lt;a href="https://www.jetbrains.com/idea/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A quick hello world program
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;For a more detailed introduction to java programming, I would surely encourage you to check out this wonderful &lt;a href="https://www.youtube.com/watch?v=4EP8YzcN0hQ&amp;amp;list=PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ&amp;amp;index=3" rel="noopener noreferrer"&gt;Introduction to Java - Architecture &amp;amp; Installation&lt;/a&gt; by &lt;em&gt;kunal kushwaha&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://github.com/rukundob451" rel="noopener noreferrer"&gt;github&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt;, thank you.&lt;/p&gt;

&lt;p&gt;Happy new month to all of you!&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>opensource</category>
      <category>dsa</category>
    </item>
    <item>
      <title>Getting started with open source ~ Git and Github</title>
      <dc:creator>Benjamin Rukundo</dc:creator>
      <pubDate>Fri, 24 Sep 2021 22:13:21 +0000</pubDate>
      <link>https://dev.to/rukundob451/git-and-github-getting-started-with-opensource-12o8</link>
      <guid>https://dev.to/rukundob451/git-and-github-getting-started-with-opensource-12o8</guid>
      <description>&lt;h3&gt;
  
  
  What is open source?
&lt;/h3&gt;

&lt;p&gt;Open source software is software with source code that anyone can inspect, modify, and enhance.&lt;/p&gt;

&lt;p&gt;"Source code" is the part of software that most computer users don't ever see; it's the code computer programmers can manipulate to change how a piece of software—a "program" or "application"—works. Programmers who have access to a computer program's source code can improve that program by adding features to it or fixing parts that don't always work correctly&lt;/p&gt;

&lt;h3&gt;
  
  
  Making your first contribution
&lt;/h3&gt;

&lt;p&gt;Being able to make your first contribution might seem overwhelming but with these few steps am sure you'll properly get the hang of what exactly to do.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to contribute?
&lt;/h3&gt;

&lt;p&gt;1.Fork the project&lt;br&gt;
&lt;a href="https://media.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%2Fhyl74m1y48x1217w9gbe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fhyl74m1y48x1217w9gbe.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.Make any changes in your forked repo&lt;/p&gt;

&lt;p&gt;3.On this repo, click Pull Requests and raise a Pull Request selecting your fork on the right drop down&lt;/p&gt;

&lt;p&gt;Questions can be asked by raising an Issue.&lt;/p&gt;
&lt;h3&gt;
  
  
  How to clone repo and make changes locally?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Click on the clone button (green in color). This gives you a copy &lt;br&gt;
of the project. It's now yours to play around with.&lt;br&gt;
&lt;a href="https://media.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%2Fxpdk516d2cgp9vvesh60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxpdk516d2cgp9vvesh60.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using Git on your local machine. Do this to download the forked copy of this repo to your computer.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  git clone https://github.com/yourGithubUsername/nameOfProject.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;switch to the cloned folder. This can be done with Gitbash or the integrated terminal in the VSCode editor.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd nameOfProject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Make a new branch. Your name would make a good branch because it's unique.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git checkout -b &amp;lt;name of new branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Open the file that needs to be contributed to an example the README.md file&lt;/li&gt;
&lt;li&gt;Make the necessary changes needed to be made lets take an instance of adding your name to the README.md file and next to it add the link to your github username page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, -&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;Full Name https://github.com/your-username&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stage your changes
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git add README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  git add .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Commit the changes.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git commit -m "Add &amp;lt;your-github-username&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check the status of your repository.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Pushing your repository to GitHub.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git push origin &amp;lt;name of your branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git branch -M main
 git push -u origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Navigate to your fork, on the top of the files section you'll notice a new section containing, a contribute button!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on the contribute button, it will open a drop down, click the pull request button on the drop down. &lt;br&gt;
Note: A pull request allows your changes to be merged with the original project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wait for your changes to be merged.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hurray! You successfully made a contribution! 🎉&lt;/p&gt;

&lt;p&gt;And with surely these steps above and different alternatives, you can surely be able to make your first contribution. Happy Contributing indeed.&lt;/p&gt;

&lt;p&gt;For more resources and information about contributing to open source using git and github, checkout this toturial &lt;a href="https://www.youtube.com/watch?v=apGV9Kg7ics&amp;amp;list=PL9gnSGHSqcnrtJr849xyLhj2WiTV15Ret" rel="noopener noreferrer"&gt;Git and Github&lt;/a&gt; by &lt;em&gt;Kunal Kushwaha&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on &lt;a href="https://github.com/rukundob451" rel="noopener noreferrer"&gt;github&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/benjamin-rukundo-539ab01a6/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, thank you.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>opensource</category>
      <category>beginnner</category>
    </item>
  </channel>
</rss>
