<?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: Arshad Ali</title>
    <description>The latest articles on DEV Community by Arshad Ali (@codecrafterking).</description>
    <link>https://dev.to/codecrafterking</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%2F1261836%2F07e60a6e-7475-4437-b8e3-10dae79e7b3c.png</url>
      <title>DEV Community: Arshad Ali</title>
      <link>https://dev.to/codecrafterking</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codecrafterking"/>
    <language>en</language>
    <item>
      <title>JAVA-Variable Scope</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 03:31:41 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-variable-scope-2k1o</link>
      <guid>https://dev.to/codecrafterking/java-variable-scope-2k1o</guid>
      <description>&lt;p&gt;main.java&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) {

        //local = declared inside a method
        //        visible only to that method

        //global = declared outside a method, but within a class
        //         visible to all parts of a class

            DiceRoller diceRoller = new DiceRoller();
    }           

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

&lt;/div&gt;



&lt;p&gt;class.java&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.Random;

public class DiceRoller {

    Random random;
    int number = 0;


    DiceRoller(){
        Random random = new Random; 
        roll();
    }

    void roll() {
        number = Random.nextInt (6)+1;
        System.out.println(number);
    }

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA- Constructors</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 03:22:30 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-constructors-339b</link>
      <guid>https://dev.to/codecrafterking/java-constructors-339b</guid>
      <description>&lt;p&gt;main.java&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) {

        Human human1 = new Human("Rick", 65,70);
        Human human2 = new Human("Morty", 16,50);

        //System.out.println(human1);
        //System.out.println(human2);

        human1.eat();
        human2.drink();
    }           

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

&lt;/div&gt;



&lt;p&gt;class.java&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 Human {

    String name;
    int age;
    double weight;

    Human(String name, int age, double weight){

        this.name = name;
        this.age = age;
        this.weight = weight;
    }

    void eat() {
        System.out.println(this.name+" is eating");
    }
    void drink() {
        System.out.println(this.name+" is drinking *burp*");
    }

}

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA- OOP(Object Oriented Programming)</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 02:12:22 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-oopobject-oriented-programming-4jlf</link>
      <guid>https://dev.to/codecrafterking/java-oopobject-oriented-programming-4jlf</guid>
      <description>&lt;p&gt;main.java&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) {

        //object = an instance of a class that may cantain attributes and methods
        //example: (phone, desk, computer, coffee cup)

            Car myCar1 = new Car();
            Car myCar2 = new Car();

            System.out.println(myCar1.make);
            System.out.println(myCar2.model);
            System.out.println();
            System.out.println(myCar1.make);
            System.out.println(myCar2.model);
            //myCar.drive();
            //myCar.brake();
    }           

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

&lt;/div&gt;



&lt;p&gt;Class.java&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 Car {

    String make = "Chevrolet";
    String model = "Corvette";
    int year = 2020;
    String color = "blue";
    double price = 50000.00;

    void drive() {
        System.out.println("You drive the car");

    }
    void brake() {
        System.out.println("You step on the breaks");
    }   
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA- Final Keyword</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 01:55:18 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-final-keyword-2365</link>
      <guid>https://dev.to/codecrafterking/java-final-keyword-2365</guid>
      <description>&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) {

        final double PI = 3.14159;//final means final unable to take second variable ex. int x = 24;

        System.out.println(PI);
    }           

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA- Printf</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 01:51:30 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-printf-a8f</link>
      <guid>https://dev.to/codecrafterking/java-printf-a8f</guid>
      <description>&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) {

        //printf() = an optional method to control, format, and display text to the console windows
        //          two arguments = format string + (object/variable/value)
        //          % [flages] [precision] [conversion-character]

        boolean myBoolean = true;
        char myChar = '@';
        String myString = "Bro";
        int myInt = 50;
        double myDouble = 1000;

        //Conversion Character
        //System.out.printf("%b", myBoolean);
        //System.out.printf("%c", myChar);
        //System.out.printf("%s", myString);
        //System.out.printf("%d", myInt);
        //System.out.printf("%f", myDouble);

        //Width
        //minimum number of characters to be written as output
        System.out.println("Hello %s", myString);

        //precision
        //sets number of digits of precision when outputting floating-point values
        //System.out.println("You have this money %.2f ", myDouble);

        //flags
        //adds an effect to output based on the flag added to formate specifier
        // - : left-justify
        // + : output a plus (+) or minus(-) sign for a numeric value
        // 0 : numeric values are zero-padded
        // , : comma grouping separator if numbers &amp;gt; 1000
    }           

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA- Overloaded Methods</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 01:26:28 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-overloaded-methods-2g0o</link>
      <guid>https://dev.to/codecrafterking/java-overloaded-methods-2g0o</guid>
      <description>&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) {

            //overloaded methods = methods that share the same name but have different parameters
            //                     method name + parameters = method signature

                int x = add(1,2,3,4);

                System.out.println(x);


    }
            static int add(int a, int b) {
                System.out.println("This is overloaded method #1");
                return a + b;
            }
            static int add(int a, int b, int c) {
                System.out.println("This is overloaded method #2");
                return a + b + c;
            }
            static int add(int a, int b, int c, int d) {
                System.out.println("This is overloaded method #3");
                return a + b + c + d;
            }

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA-Methods</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 01:14:48 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-methods-3phf</link>
      <guid>https://dev.to/codecrafterking/java-methods-3phf</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import  java.util.ArrayList;

public class Main {

            public static void main(String[] args) {

    //method = a block of code that is executed whenever it is called upon

            String name = "Bro";
            int age = 21;

            hello(name, age);

        }

            static void hello(String name, int age) {
                System.out.println("Hello "+name);
                System.out.println("Hello "+age);
            }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Second Methods&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import  java.util.ArrayList;

public class Main {

            public static void main(String[] args) {

    //method = a block of code that is executed whenever it is called upon

            int x = 3;
            int y = 4;

            int z = add(x,y);

            System.out.println(z);

        }

            static int add(int x, int y) {
                int z = x + y;
                return z;
     }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA-For-Each Loop</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 00:40:51 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-for-each-loop-1bke</link>
      <guid>https://dev.to/codecrafterking/java-for-each-loop-1bke</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import  java.util.ArrayList;

public class Main {

            public static void main(String[] args) {

    //for-each = traversing technique to iterate through the element in an array/collection
    //          less steps, more readable
    //          less flexible

    //String[] animals = {"cat", "dog","rat","bird"};
        ArrayList&amp;lt;String&amp;gt; animals = new ArrayList&amp;lt;String&amp;gt;();

        animals.add("Cat");
        animals.add("dog");
        animals.add("rat");
        animals.add("bird");

        for(String i:animals) {
            System.out.println(i);
        }

        }

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA- 2DArray List</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 00:19:03 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-2darray-list-51jn</link>
      <guid>https://dev.to/codecrafterking/java-2darray-list-51jn</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.ArrayList;

public class Main {

        public static void main(String[] args) {

        //2D ArrayList = a dynamic list of lists
        //You can change the size of these lists during runtime

        ArrayList&amp;lt;ArrayList&amp;lt;String&amp;gt;&amp;gt; groceryList = new ArrayList();

        ArrayList&amp;lt;String&amp;gt; bakeryList = new ArrayList();
        bakeryList.add("pasta");
        bakeryList.add("garlic bread");
        bakeryList.add("donuts");

        ArrayList&amp;lt;String&amp;gt; produceList = new ArrayList();
        produceList.add("tomatoes");
        produceList.add("Zucchini");
        produceList.add("pepper");

        ArrayList&amp;lt;String&amp;gt; drinksList = new ArrayList();
        drinksList.add("Soda");
        drinksList.add("Coffee");

        groceryList.add(bakeryList);
        groceryList.add(produceList);
        groceryList.add(drinksList);

        System.out.println(groceryList);

    }

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA-ArrayList</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sun, 21 Jan 2024 00:05:35 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-arraylist-1op7</link>
      <guid>https://dev.to/codecrafterking/java-arraylist-1op7</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.ArrayList;

public class Main {

        public static void main(String[] args) {

        //ArrayList = a resizable array.
        //          Element can be added and removed after compilation phase
        //          store reference data types.

            ArrayList&amp;lt;String&amp;gt; food = new ArrayList&amp;lt;String&amp;gt;();

            food.add("pizza");
            food.add("hamburger");
            food.add("Noodles");

            food.set(0, "sushi");
            food.remove(2);
            //food.clear();

            for(int i=0; i&amp;lt;food.size(); i++) {
                System.out.println(food.get(i));
            }


    }

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA- Wrapper Classes</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sat, 20 Jan 2024 23:56:26 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-wrapper-classes-37eb</link>
      <guid>https://dev.to/codecrafterking/java-wrapper-classes-37eb</guid>
      <description>&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) {


        //wrapper class = provides a way to use primitive data types as reference data types
        //                reference data types contain useful methods
        //                can be used with collections (ex.ArrayList)

        //primitive     //Wrapper
        //
        //boolean       Boolean
        //char          Character
        //int           Integer
        //double        Double

        //autoboxing = the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes.
        //unboxing = the reverse of autoboxing. Automatic conversion of wrapper class to primitive

        Boolean a = true;
        Character b = '@';
        Integer c = 123;
        Double d = 3.14;
        String e = "Bro";

        if (b=='@') {
            System.out.println("This is true");
        }


    }

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>JAVA-String Methods</title>
      <dc:creator>Arshad Ali</dc:creator>
      <pubDate>Sat, 20 Jan 2024 23:34:30 +0000</pubDate>
      <link>https://dev.to/codecrafterking/java-string-methods-10gd</link>
      <guid>https://dev.to/codecrafterking/java-string-methods-10gd</guid>
      <description>&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) {


        //String  =  a reference data type that can store one or more characters
        //          reference data types have access to useful methods

        String name = "Bro";

        //boolean result = name.equalsIgnoreCase("Bro");
        //int result = name.length();
        //char result = name.charAt(0);
        //int result = name.indexOf("o");
        //boolean result = name.isEmpty();
        //String result = name.toUpperCase();
        //String result = name.toLpperCase();
        //String result = name.totrim();
        String result = name.replace('o','a');

        System.out.println(result);


    }

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

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
