<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Introduction to Application Development with Java - Medium]]></title>
        <description><![CDATA[A collection of notes and guides pertaining to the design and delivery of software solutions using the Java programming language. Intended for readers with little to no background in technology. - Medium]]></description>
        <link>https://medium.com/introduction-to-application-development-with-java?source=rss----3727b33c89fc---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Introduction to Application Development with Java - Medium</title>
            <link>https://medium.com/introduction-to-application-development-with-java?source=rss----3727b33c89fc---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 12 Nov 2026 19:09:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/introduction-to-application-development-with-java" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Text File Handling]]></title>
            <link>https://medium.com/introduction-to-application-development-with-java/text-file-handling-586d98dc6657?source=rss----3727b33c89fc---4</link>
            <guid isPermaLink="false">https://medium.com/p/586d98dc6657</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[getting-started-with-tech]]></category>
            <category><![CDATA[introduction-to-java]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[getting-started-with-java]]></category>
            <dc:creator><![CDATA[Dennis Kalaygian]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 02:23:01 GMT</pubDate>
            <atom:updated>2024-09-14T02:22:21.370Z</atom:updated>
            <content:encoded><![CDATA[<p>Java provides developers with existing code libraries that simplify the process of creating, reading, writing and manipulating local files.</p><p>A text file can be created with the following command:</p><pre>File file = new File(&quot;file.txt&quot;);</pre><p>In this case, a text file named <em>file.txt</em> will be created, and the developer is free to write text to that file.</p><pre>FileWriter fw = new FileWriter(&quot;file.txt&quot;);<br>BufferedWriter bw = new BufferedWriter(fw);<br>bw.write(&quot;Hello, World!&quot;);<br>fw.close();<br>bw.close();</pre><p>The library also enables developers to read text files, line by line.</p><pre>FileReader fr = new FileReader(&quot;file.txt&quot;);<br>BufferedReader br = new BufferedReader(fr);<br>String line = br.readLine(); // reads a single line<br>fr.close();<br>br.close();</pre><p>It is important to note that the <em>close()</em> method must be invoked once the file handling operation is over. If they aren’t closed, then the application will eventually crash due to resource mismanagement. Additionally, the example above is still vulnerable to crashing despite calling <em>close()</em> explicitly — if an exception occurs while the <em>BufferedReader</em> is reading a line, then the file handlers will never close.</p><p>Fortunately, Java offers a syntax that will automatically invoke this <em>close()</em> method for the developer, regardless of whether or not exceptions occur.</p><pre>try (FileWriter fw = new FileWriter(&quot;file.txt&quot;, true); BufferedWriter bw = new BufferedWriter(fw)) {<br>    bw.write(&quot;Hello, World!&quot;);<br>} catch (IOException e) {<br>    e.printStackTrace();<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=586d98dc6657" width="1" height="1" alt=""><hr><p><a href="https://medium.com/introduction-to-application-development-with-java/text-file-handling-586d98dc6657">Text File Handling</a> was originally published in <a href="https://medium.com/introduction-to-application-development-with-java">Introduction to Application Development with Java</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exception Handling]]></title>
            <link>https://medium.com/introduction-to-application-development-with-java/exception-handling-9ebb2fc13626?source=rss----3727b33c89fc---4</link>
            <guid isPermaLink="false">https://medium.com/p/9ebb2fc13626</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[getting-started-with-java]]></category>
            <category><![CDATA[getting-started-with-tech]]></category>
            <category><![CDATA[introduction-to-java]]></category>
            <dc:creator><![CDATA[Dennis Kalaygian]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 01:54:40 GMT</pubDate>
            <atom:updated>2024-09-14T01:54:32.274Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>The Java Exception</strong></p><p>Exceptions are data structures that are generated when the intended functionality is disrupted. They are used to identify issues, provide users with messages, provide developers with information about the problematic event and so on.</p><p>For example, an <em>IndexOutOfBoundsException </em>can be triggered by attempting to access the tenth element of an array with nine elements.</p><pre>int indexOfTenthElement = 9; // arrays start with index 0<br><br>System.out.println(arrayWithNineElements[indexOfTenthElement]); // throws an IndexOutOfBoundsException</pre><p>An exception that is not handled will crash an application.</p><p><strong>Handling Exceptions</strong></p><p>Exceptions can be handled with <em>try / catch</em> blocks — these keywords allow developers to provide the software with multiple paths of execution, depending on whether or not a specific exception occurs.</p><pre>try {<br>  int indexOfTenthElement = 9;<br>  System.out.println(arrayWithNineElements[indexOfTenthElement]); // throws an IndexOutOfBoundsException<br>} catch (IndexOutOfBoundsException ex) {<br>  System.out.println(&quot;The index was out of bounds with message: &quot;.concat(ex.getMessage()));<br>}</pre><p>An additional <em>finally</em> keyword can be used to execute additional statements, regardless of whether or not the <em>catch</em> block is invoked.</p><pre>try {<br>  int indexOfTenthElement = 9;<br>  System.out.println(arrayWithNineElements[indexOfTenthElement]); // throws an IndexOutOfBoundsException<br>} catch (IndexOutOfBoundsException ex) {<br>  System.out.println(&quot;The index was out of bounds with message: &quot;.concat(ex.getMessage()));<br>} finally {<br>  System.out.println(&quot;Finished executing!&quot;);<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ebb2fc13626" width="1" height="1" alt=""><hr><p><a href="https://medium.com/introduction-to-application-development-with-java/exception-handling-9ebb2fc13626">Exception Handling</a> was originally published in <a href="https://medium.com/introduction-to-application-development-with-java">Introduction to Application Development with Java</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing Methods]]></title>
            <link>https://medium.com/introduction-to-application-development-with-java/writing-methods-243e07002d77?source=rss----3727b33c89fc---4</link>
            <guid isPermaLink="false">https://medium.com/p/243e07002d77</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[getting-started-with-java]]></category>
            <category><![CDATA[getting-started-with-tech]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[introduction-to-java]]></category>
            <dc:creator><![CDATA[Dennis Kalaygian]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 01:53:28 GMT</pubDate>
            <atom:updated>2024-09-14T01:53:18.222Z</atom:updated>
            <content:encoded><![CDATA[<p>A method is a block of code that can be invoked; the example below includes the <em>main </em>method, and a <em>getFullName </em>method.</p><pre>public static void main(String args[]) {<br>    String bossFirstName = &quot;Michael&quot;;<br>    String bossLastName = &quot;Scott&quot;;<br>    String bossFullName = getFullName(bossFirstName, bossLastName);<br>}<br><br>static String getFullName(String firstName, String lastName) {<br>    return firstName.concat(&quot; &quot;).concat(lastName);<br>}</pre><p>A <em>parameter</em> is a variable that indicates an input value that is expected by a method upon invocation. In this case, <em>String firstName </em>and <em>String lastName </em>are the parameters in the second example; as long as two pieces of text are supplied (regardless of their variable names), the method will be able to combine the text with a space in between.</p><p>An <em>argument </em>is the actual value that is passed into a method. In the example above, <em>getFullName(bossFirstName, bossLastName) </em>is the moment that <em>bossFirstName </em>and <em>bossLastName </em>become arguments; those variables are passed into the method, and the associated values will be combined with a space between them.</p><p>A <em>signature </em>is the name of the method, combined with the list of accepted parameters. The <em>getFullName </em>method has a signature of <em>getFullName(String firstName, String lastName)</em>. This signature is used to indicate a method’s uniqueness to the compiler, so that when it is invoked with arguments the compiler knows which code to execute.</p><p>A <em>return type </em>indicates the type of data that the method returns.</p><pre>static String getFullName(String firstName, String lastName) {<br>    return firstName.concat(&quot; &quot;).concat(lastName);<br>}</pre><p>The code above defines a method that returns a new <em>String</em>, which is equal to the first argument combined with the second. This returned <em>String </em>can be stored in a new variable.</p><pre>String bossFullName = getFullName(bossFirstName, bossLastName);</pre><p>Some methods will not return any values, such as methods that print text. These are marked with a <em>void </em>return type.</p><pre>public static void main(String args[]) {<br>    String name = &quot;Bob&quot;;<br>    print(name);<br>}<br><br>static void print(String text) {<br>    System.out.println(text); // nothing returned; text is printed and method terminates<br>}</pre><p>As indicated above, a returned value needs to be stored in another variable or passed directly into another method. Otherwise, the value disappears.</p><pre>getFullName(bossFirstName, bossLastName); // does nothing<br><br>String bossFullName = getFullName(bossFirstName, bossLastName); // stores the full name in a variable<br>System.out.println(getFullName(bossFirstName, bossLastName)); // prints the full name</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=243e07002d77" width="1" height="1" alt=""><hr><p><a href="https://medium.com/introduction-to-application-development-with-java/writing-methods-243e07002d77">Writing Methods</a> was originally published in <a href="https://medium.com/introduction-to-application-development-with-java">Introduction to Application Development with Java</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arrays and Collections]]></title>
            <link>https://medium.com/introduction-to-application-development-with-java/arrays-and-collections-768c23fc5233?source=rss----3727b33c89fc---4</link>
            <guid isPermaLink="false">https://medium.com/p/768c23fc5233</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[getting-started-with-java]]></category>
            <category><![CDATA[getting-started-with-tech]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[introduction-to-java]]></category>
            <dc:creator><![CDATA[Dennis Kalaygian]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 01:51:52 GMT</pubDate>
            <atom:updated>2024-09-14T01:51:35.544Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Arrays</strong></p><p>An array is a data structure that holds a group of values with the same type as one another.</p><pre>int[] integers = new int[]{2, 4, 5}; // &#39;integers&#39; contains 2, 4 and 5</pre><p>The number of values that an array can hold must be defined when the array is instantiated.</p><pre>int[] integers = new int[]{2, 4, 5}; // compiler knows size is three<br>int[] integers = int[3]; // compiler knows size is three</pre><p>The values within an array are called elements, and each element is referenced by specifying it’s position in sequence, known as the index.</p><pre>int[] integers = new int[]{2, 4, 5};<br><br>System.out.println(integers[0]); // prints 2<br>System.out.println(integers[2]); // prints 5<br>System.out.println(integers[3]); // throws an error<br>integers[1] = 6;<br>System.out.println(integers[1]); // prints 6 instead of 4</pre><p>Aside from the basic functionality that comes with all complex types in Java, an array cannot perform operations of its own.</p><p><strong>Collections</strong></p><p>A collection is a data type in Java that serves as a version of an array with build in functionality.</p><pre>Collection&lt;String&gt; names = new ArrayList&lt;&gt;(); // collection instantiation syntax will be explained later<br><br>names.add(&quot;Bob&quot;);<br>names.add(&quot;Jon&quot;);<br>System.out.println(names.get(1)); // prints &#39;Jon&#39;</pre><p>Collection size is not fixed upon instantiation and it is able to perform its own operations, but it is slightly less efficient than an array in terms of element modification and access.</p><p><strong>Types of Collections</strong></p><p>Elements are inserted, accessed and removed depending on the specific type of collection. Each has its own advantages and challenges.</p><p>Lists</p><pre>List&lt;String&gt; names = new ArrayList&lt;&gt;();</pre><ul><li>Position based on number, starting at zero (called an index)</li><li>Allows for access by index</li><li>Allows for duplicates</li><li>Performance slows as size grows</li></ul><p>Sets</p><pre>Set&lt;String&gt; uniqueNames = new HashSet&lt;&gt;();</pre><ul><li>Position based on number, starting at zero</li><li>Does not allow for access by index</li><li>Does not allow duplicates</li><li>Performance slows as size grows</li></ul><p>Queues</p><pre>Queue&lt;String&gt; foodOrders = new ArrayDeque&lt;&gt;();</pre><ul><li>The first element in is the first element out</li><li>Allows for duplicates</li><li>Performance slows as size grows</li></ul><p>Maps</p><pre>Map&lt;String, String&gt; employeeJobTitles = new HashMap&lt;&gt;();<br>employeeJobTitles.put(&quot;Bob&quot;, &quot;Software Developer&quot;);<br><br>System.out.println(employeeJobTitles.get(&quot;Bob&quot;)); // prints &#39;Software Developer&#39;</pre><ul><li>Key based (stores job titles based on the employee’s name)</li><li>Keys cannot be duplicated, but values can (only one Bob, but can have multiple Software Developers)</li><li>Performance isn’t impacted on the same scale as other collection types as the size grows</li><li>Even though <em>Map </em>is a part of the collection framework, it does not inherit the default <em>Collection </em>functionality.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=768c23fc5233" width="1" height="1" alt=""><hr><p><a href="https://medium.com/introduction-to-application-development-with-java/arrays-and-collections-768c23fc5233">Arrays and Collections</a> was originally published in <a href="https://medium.com/introduction-to-application-development-with-java">Introduction to Application Development with Java</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Control Flow]]></title>
            <link>https://medium.com/introduction-to-application-development-with-java/control-flow-ec2bc138e956?source=rss----3727b33c89fc---4</link>
            <guid isPermaLink="false">https://medium.com/p/ec2bc138e956</guid>
            <category><![CDATA[introduction-to-java]]></category>
            <category><![CDATA[getting-started-with-java]]></category>
            <category><![CDATA[getting-started-with-tech]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Dennis Kalaygian]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 01:44:49 GMT</pubDate>
            <atom:updated>2024-09-14T01:44:41.395Z</atom:updated>
            <content:encoded><![CDATA[<p>When a Java application starts, the first code to be executed is the first line of the entry point. After that, each line is executed in the order that it appears — unless the flow of control dictates otherwise.</p><p><strong>If / Else Statements</strong></p><p>Consider a message that is printed on the screen of an ATM — if someone withdraws twenty dollars from a total of forty dollars, they’ll see a success message. If they try to withdraw twenty dollars from a balance of ten dollars, they will receive an error message for over drafting.</p><pre>int total = 100;<br>int withdrawAmount = 20;<br><br>if (withdrawAmount &gt; total) {<br>  System.out.println(&quot;Error: Overdraft&quot;); // withdrawl greater than total<br>} else if (withdrawAmount &lt; total) {<br>  System.out.println(&quot;Success: Withdrew from account&quot;); // withdrawl less than total<br>} else {<br>  System.out.println(&quot;Withdrew all cash&quot;); // withdrawl equal to total<br>}</pre><p>Because <em>withdrawAmount </em>is less than <em>total</em>, the first print statement is skipped, the second print statement is executed, and the third print statement is ignored entirely.</p><p><strong>Switch Statements</strong></p><p>The <em>switch </em>statement can also be used to determine the flow of control based on a value.</p><pre>int number = 6;<br><br>switch (number) {<br>    case 1:<br>        // execute logic if the input value matches the first expected value<br>        break;<br>    case 5:<br>        // execute logic if the input value matches the second expected value<br>        break;<br>    default:<br>        // execute logic if the input value does not match any expected values<br>}</pre><p>The <em>default</em> statement is optional, and in this case it will be executed since <em>number </em>is not equal to one or five.</p><p><strong>Looping</strong></p><p>A loops is used to conditionally and repeatedly execute a block of code. The <em>continue </em>statement skips the remainder of the current loop iteration, and the <em>break </em>statement terminates the associated loop entirely.</p><p><strong>The ‘while’ Loop</strong></p><p>A <em>while </em>loop is a combination of a conditional statement and a block of code; upon invocation, the block of code will be repeatedly executed until the condition is met.</p><pre>int i = 0;<br>while (i &lt; 10) {<br>    System.out.println(i); // prints ten integers, 0 - 9<br>    i++; // if this line was missing, the loop would execute forever because &#39;i&#39; would always be less than ten<br>}</pre><p>The <em>while </em>loop checks the condition before executing the logic. The <em>do while </em>loop checks the condition after executing the logic.</p><pre>int i = 0;<br>do {<br>    System.out.println(i); // prints ten integers, 0 - 9<br>    i++;<br>} while (i &lt; 10);</pre><p><strong>The ‘for’ Loop</strong></p><p>A <em>for </em>loop is used to execute a block of code a pre determined number of times.</p><pre>for (int num = 3; num &gt; 1; num--) { // start with 3, execute when greater than one, subtract one every time<br>  System.out.println(num); // prints 3, 2<br>}</pre><p>The control variable (in the case above, named <em>num</em>) can be decalred within the loop such as the example above, or outside of the loop.</p><pre>int num = 3;<br>for (num; num &gt; 1; num--) { // start with 3, execute when greater than one, subtract one every time<br>  System.out.println(num); // prints 3, 2<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec2bc138e956" width="1" height="1" alt=""><hr><p><a href="https://medium.com/introduction-to-application-development-with-java/control-flow-ec2bc138e956">Control Flow</a> was originally published in <a href="https://medium.com/introduction-to-application-development-with-java">Introduction to Application Development with Java</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Operators]]></title>
            <link>https://medium.com/introduction-to-application-development-with-java/operators-9c25f12a27a1?source=rss----3727b33c89fc---4</link>
            <guid isPermaLink="false">https://medium.com/p/9c25f12a27a1</guid>
            <category><![CDATA[introduction-to-java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[getting-started-with-java]]></category>
            <category><![CDATA[getting-started-with-tech]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Dennis Kalaygian]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 01:42:02 GMT</pubDate>
            <atom:updated>2024-09-14T01:45:39.368Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Arithmetic Operators</strong></p><p>Arithmetic operators are symbols that are used to carry out arithmetic, assignment, relational and logical operations. Assignment operators change the value of the variable on the left side of the equation. Relational operators compare values to one another (== is <em>equals</em>, != is <em>not equals</em>) and logical operators are used to evaluate some combination of boolean conditions.</p><ul><li>Arithmetic: <strong>+</strong>, <strong>-</strong>, <strong>*</strong>, <strong>/</strong></li><li>Assignment: <strong>=</strong>, <strong>+=</strong>, <strong>*=</strong></li><li>Relational: <strong>&gt;</strong>, <strong>&lt;</strong>, <strong>==</strong>, <strong>!=, &gt;=, &lt;=</strong></li><li>Logical: <strong>&amp;</strong>, <strong>&amp;&amp;</strong>, <strong>|</strong>, <strong>||</strong></li></ul><pre>int total = 3 + 4; // assignment and arithmetic, value is 7<br>int total += 1; // assignment, value is 8<br>boolean totalIsLarge = total &gt;= 10; // assignment and relational, value is false<br>boolean totalIsSmallAndGreaterThanOne = total &lt; 10 &amp;&amp; total &gt; 1; // assignment, relational, logical and relational</pre><p><strong>Operator Precedence</strong></p><p>The order of operations, from highest precedence to lowest, is as follows.</p><ul><li><strong>Post-Unary</strong>: Operators that are applied after the value they operate on is returned</li><li><strong>Pre-Unary</strong>: Operators that are applied before the value they operate on is returned</li><li><strong>Parenthesis</strong>: Used to prioritize specific operations over others</li><li><strong>Single Unary</strong>: Operates on a single operand, which can be a variable or an expression</li><li><strong>Multiplicative</strong>: Multiplication, division and modulus</li><li><strong>Additive</strong>: Addition and subtraction</li><li><strong>Relational and Equality</strong>: Compares two values to each other</li><li><strong>Logical</strong>: Determines a presence of specified conditions</li><li><strong>Ternary</strong>: Returns one of two values depending on the outcome of a relational operation</li><li><strong>Assignment</strong>: Assigns a value to the variable on the left of the equation</li></ul><p><strong>Relational Operators</strong></p><p>Relational operators are used to compare two values or expressions and determine their relationship. These operators return a boolean result, either <em>true</em> or <em>false</em>, based on the specified relationship.</p><pre>boolean firstNumberLessThanOrEqualToSecondNumber = 5 &lt;= 8; // returns true<br>boolean thirdNumberLessThanOrEqualToFourthNumber = 9 &lt;= 9; // returns true<br>boolean fourthNumberIsLessThanFirstNumber = 10 &lt; 5; // returns false</pre><p>Relational operators are also used to compare two values or expressions and determine whether or not they’re equal. These operators return a boolean result, either <em>true</em> or <em>false</em>.</p><pre>boolean equalToEachOther = 5 == 5; // returns true because they are equal<br>boolean equalToEachOther = 5 != 4; // returns true because they are not equal</pre><p><strong>Pre and Post Unary Operators</strong></p><p>Pre and post unary operators are responsible for incrementing or decrementing primitive variables values.</p><pre>double x = 1.5;<br><br>++x; // x = 2.5<br>--x; // x = 1.5</pre><p><strong>The Math Class</strong></p><p>The Math class provides a library of methods that are useful for working with numbers. For example a random double value between 0 and 1 can be generated with the following code:</p><pre>double value = Math.random(); // can be 0, non inclusive of 1</pre><p>Another example is the ability to return the minimum or maximum of two values:</p><pre>int a = 3;<br>int b = 4;<br>int minimum = Math.min(a, b); // returns 3</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c25f12a27a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/introduction-to-application-development-with-java/operators-9c25f12a27a1">Operators</a> was originally published in <a href="https://medium.com/introduction-to-application-development-with-java">Introduction to Application Development with Java</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Types]]></title>
            <link>https://medium.com/introduction-to-application-development-with-java/data-types-9633b654716b?source=rss----3727b33c89fc---4</link>
            <guid isPermaLink="false">https://medium.com/p/9633b654716b</guid>
            <category><![CDATA[introduction-to-java]]></category>
            <category><![CDATA[getting-started-with-tech]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[getting-started-with-java]]></category>
            <dc:creator><![CDATA[Dennis Kalaygian]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 01:38:42 GMT</pubDate>
            <atom:updated>2024-09-14T01:49:13.020Z</atom:updated>
            <content:encoded><![CDATA[<p>A data type is a label that defines the operations that a value can perform, as well as the operations that can be applied to that value. For example, if two pieces of data are labeled as text and added together, then the compiler will know to combine the two pieces of text into one piece of text. However, if those two pieces of data are labeled as numbers and added together, then the compiler will know to calculate the total of the numbers.</p><p>These values are referenced through user defined variables, and can be in one of two states. A <strong>declared</strong> variable has reserved system memory for the future value, but does not reference an actual value.</p><pre>String name; // does not assign a value to name; reserves space in memory</pre><p>An <strong>instantiated</strong> variable holds an actual value.</p><pre>String name = &quot;Jim&quot;;</pre><p>Java recognizes two categories of data types; primitive, and complex.</p><p><strong>Primitive Data Types</strong></p><p>Primitive data types are predefined by the language, and are used to represent ‘simple’ data types such as numbers, characters, etc. The value possesses only state; a value that is of a primitive type cannot perform any operations, but operations can still be applied to the value.</p><p>As mentioned previously the value is stored directly in the variable. This location in computer memory is known as the ‘stack’, which is relatively close to the running application for quick access.</p><p>Examples of primitive type variable instantiations include:</p><pre>int age = 22;<br>char grade = &#39;A&#39;;<br>double cost = 20.00<br>boolean isQualified = true;</pre><p><strong>Complex Data Types</strong></p><p>Complex data types are predefined by the language, by libraries and can be defined by developers. They posses behavior in addition to state.</p><p>Complex values are stored in a memory location known as the ‘heap’, which lives further from the running application than the stack does. In order to bridge this gap, a reference to the value’s location in the heap is stored within the stack. This reference is known as a ‘pointer’. This can be confirmed by printing the location in memory of objects, which is what Java does by default.</p><pre>Object firstObject = new Object();<br>Object copyOfFirstObject = firstObject;<br>Object secondObject = new Object();<br><br>System.out.println(firstObject);<br>System.out.println(copyOfFirstObject); # prints the same thing as firstObject<br>System.out.println(secondObject); #does not print the same thing as firstObject, even though both are blank</pre><p>The <em>String </em>variable is a complex type, used to represent strings of characters (simple text).</p><pre>String firstName = &quot;Bob&quot;;<br>String lastName = &quot;Doe&quot;;<br>String fullName = firstName.concat(&quot; &quot;).concat(lastName); // firstName is performing an operation</pre><p><strong>Integral Types</strong></p><p>Integral types refer to data types used to store integer values. These data types represent whole numbers, without any fractional or decimal components.</p><ul><li><em>byte</em> is a sequence of eight bits that can have a value between -128 and 127</li><li><em>short </em>is a sequence of sixteen bits (2 bytes) with a range between -32,768 and 32,767</li><li><em>int</em> is a sequence of thirty two bits (4 bytes) with a range between -2,100,000,000 and 2,100,000,000</li><li><em>long</em> is a sequence of sixty four bits (8 bytes) with a range between -9.2 x ¹⁰¹⁸ and 9.2 x ¹⁰¹⁸</li></ul><p><strong>Floating Point Types</strong></p><p>Floating-point types are used to represent numbers with a fractional part, including real numbers such as decimal values and scientific notation.</p><ul><li><em>float</em> is a sequence of thirty two bits (4 bytes) with a range between 1.4 x 10^-45 and 3.4 x 1⁰³⁸</li><li><em>double</em> is a sequence of sixty four bits (8 bytes) with a range between 4.9 x 10^-324 and 1.8 x 1⁰³⁰⁸</li></ul><p>Both the <em>float </em>and the <em>double </em>round the last digit after the decimal point, if the value contains too many digits. A <em>double </em>can store a decimal value that is twice the size (not value) of a <em>float</em>.</p><p>The reason that these types have such a large range because of the automatic scientific notation conversion. If the absolute value (not size) is too large, the representation will automatically switch to scientific notation.</p><p><strong>The boolean Primitive</strong></p><p>The <em>boolean </em>is used to indicate a binary value, and can be only <em>true </em>or <em>false.</em></p><pre>boolean isEqual = (1 == 1); // returns true</pre><p><strong>The char Primitive</strong></p><p>The <em>char </em>primitive is used almost exclusively to represent Unicode characters such as a letter, digit, symbol, etc.</p><pre>char newline = &#39;\n&#39;;</pre><p><strong>Narrowing, Widening and Casting</strong></p><p><em>Narrowing</em> is when a number is converted from a larger data type to a smaller data type.</p><pre>long theLong = 5L;<br>int theInt = (int) theLong;</pre><p>If a number is too large then narrowing will result in a completely different number, in a phenomenon called overflow.</p><p><em>Widening </em>is when a number is converted from a smaller data type to a larger data type.</p><pre>int theInt = 5;<br>long theLong = (long) theInt;</pre><p><em>Casting </em>is the process of converting on data type to another.</p><p><strong>Underscores in Numeric Literals</strong></p><p>Underscores can be used almost anywhere within a number; however, they cannot be used at the beginning or the end, nor can they be used immediately before or after a decimal point.</p><p><strong>Scientific Notation</strong></p><p>In Java, scientific notation can only be used with <em>float </em>and <em>double. </em>A <em>float </em>can have eight digits, a <em>double</em> can have sixteen; any larger numbers will result in an automatic conversion to scientific notation and a loss in precision.</p><pre>double number = 5.88e12;<br>float anotherNumber = 5.0e-8f;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9633b654716b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/introduction-to-application-development-with-java/data-types-9633b654716b">Data Types</a> was originally published in <a href="https://medium.com/introduction-to-application-development-with-java">Introduction to Application Development with Java</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Version Control]]></title>
            <link>https://medium.com/introduction-to-application-development-with-java/introduction-to-version-control-7b394a40d71d?source=rss----3727b33c89fc---4</link>
            <guid isPermaLink="false">https://medium.com/p/7b394a40d71d</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[introduction-to-git]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Dennis Kalaygian]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 01:34:32 GMT</pubDate>
            <atom:updated>2024-09-12T00:47:03.077Z</atom:updated>
            <content:encoded><![CDATA[<p>Version control is a software tool that tracks changes to files and directories over time. It allows multiple developers to collaborate on projects, track changes and revert to previous versions if necessary. Version control software is typically used by developers in two mediums. The first is a local command line interface tool known as Git, which allows a developer to record, delete and manage changes to projects on their own system. The second is a web based platform, such as GitHub or Bitbucket. This software allows developers to store, download, review and track changes to projects.</p><h3>Version Control Locally</h3><p>Git can be downloaded from <a href="https://git-scm.com/downloads"><em>https://git-scm.com/downloads</em></a>. When downloading to Windows, Git Bash must be included as well. This is an alternative to the Command Prompt, that allows developers to execute Git commands.</p><p>Open the Git Bash application if the device is Windows, and open the Terminal if the device is a Mac. Create a directory to store projects in, navigate into this directory, create a Java project and navigate into the Java project directory.</p><pre>&gt;&gt; mkdir projects<br>&gt;&gt; cd projects<br><br>&gt;&gt; mvn archetype:generate -DgroupId=com.example -DartifactId=app-name -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false<br><br>&gt;&gt; cd app-name</pre><p>Initialize version control and begin tracking project changes by running the following Git command:</p><pre>&gt;&gt; git init</pre><p>Create a file so that Git can ignore unnecessary files while tracking changes.</p><pre>&gt;&gt; touch .gitignore</pre><p>Open this file in IntelliJ and paste the following contents:</p><pre>target/<br>.idea/<br>*.iml</pre><p>The <strong><em>target/</em></strong> directory should be ignored because it only holds compiled files and an executable, which should be generated from source files every time. The <strong><em>.idea/</em></strong> directory and <strong><em>.iml</em></strong> files should be ignored because they both contain information specific to each developer’s personal IDE.</p><p>Prepare to save all new files to the history of changes stored by Git.</p><pre>&gt;&gt; git add .</pre><p>This will add all new files to the staging index; they aren’t formally recorded by Git, but they’re now in a state where they can be saved with the following command:</p><pre>&gt;&gt; git commit -m &quot;Initial commit&quot;</pre><p>This will save all of the new files with Git, along with a message that says “Initial commit”.</p><p>Any time files or directories are created, updated or deleted, these changes can be saved by adding the files to the staging index and executing a <em>commit </em>command.</p><h3>Version Control on the Web</h3><p>Projects that are tracked via version control can be uploaded to or downloaded from web based platforms, such as GitHub and Bitbucket. In order for developer devices to securely communicate with these platforms, a secure connection must be configured between the two.</p><p>In IT, a protocol is a set of rules that define how data is transmitted and processed between systems over a network. The type of protocol that these version control platforms require is known as SSH, which stands for Secure Shell. SSH requires messages to be encrypted across the network, so that hackers can’t view sensitive information.</p><p>In order to encrypt these messages, a key must be created locally in order to establish an identity. Validate that no key exists by attempting to change into the SSH directory and list the contents. If there is no <em>.ssh</em> directory or there are no contents within the file, then there is no SSH key and one must be created.</p><pre>&gt;&gt; cd ~/.ssh<br>&gt;&gt; ls</pre><p>If an SSH key needs to be created, run the following command:</p><pre>&gt;&gt; ssh-keygen</pre><p>This will create a private key to be used locally, and a public key to be used with other websites.</p><p>Start the device’s SSH software and add the private key.</p><pre>&gt;&gt; eval $(ssh-agent)<br>&gt;&gt; ssh-add ~/.ssh/id_rsa</pre><p>Print the public key and copy the value.</p><pre>&gt;&gt; cat ~/.ssh/id_rsa.pub</pre><p>If the platform is Bitbucket, paste the public key value under <strong>Personal BitBucket Settings / SSH Keys</strong> and establish an SSH connection with the Bitbucket server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I0bhU9ZaukXEPFZU0nuGSw.png" /></figure><pre>&gt;&gt; ssh -T git@bitbucket.org</pre><p>If the platform is GitHub, paste the public key value under <strong>Settings / SSH and GPG keys / Add new SSH Key</strong> and establish an SSH connection with the GitHub server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FHdk2u5fAHAYYo711vWwEA.png" /></figure><pre>&gt;&gt; ssh -T git@github.com</pre><h3>Summary</h3><ul><li>Version control software called Git was downloaded to track changes to projects locally. If the device is not Mac, then Git Bash was also downloaded.</li><li>If an SSH key did not already exist, then public and private keys were both generated.</li><li>The private key was registered with the device’s SSH software.</li><li>The public key was used to establish asecure connection to a web based platform.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b394a40d71d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/introduction-to-application-development-with-java/introduction-to-version-control-7b394a40d71d">Introduction to Version Control</a> was originally published in <a href="https://medium.com/introduction-to-application-development-with-java">Introduction to Application Development with Java</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configuring a Java Development Environment]]></title>
            <link>https://medium.com/introduction-to-application-development-with-java/getting-started-with-application-development-c0fa8f792e28?source=rss----3727b33c89fc---4</link>
            <guid isPermaLink="false">https://medium.com/p/c0fa8f792e28</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[introduction-to-java]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Dennis Kalaygian]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 01:34:25 GMT</pubDate>
            <atom:updated>2024-09-14T01:40:09.285Z</atom:updated>
            <content:encoded><![CDATA[<p>When people develop applications, they write lines of text within files using specific keywords and syntax. These rules depend on the programming language being used, and writing text according to these rules is known as programming or coding.</p><p>In many languages, developers write code according to a specified set of rules within source files. The content of these files can be understood by developers thanks to keywords, numbers and indentation that provide context. When the source files are ready to run as software, they are translated to a file that is no longer readable by humans. This file is known as an executable, and it allows the developer to run their software.</p><h3>Installing the Java Programming Language</h3><p>This guide focuses on the Java programming language, as it enables developers to conveniently build enterprise grade software. It is secure, widely supported and there are many existing libraries (pre written code) available for use when developing software.</p><p>Java comes with everything required to create and run software. The Java Runtime Environment is the module used to run software, and the Java Development Kit is used to create software. The JRE is included within the JDK.</p><p>After creating an Oracle account, Java can be downloaded from <a href="https://www.oracle.com/java/technologies/downloads/#jdk17-windows">https://www.oracle.com/java/technologies/downloads/#jdk17-windows</a>. Once this has been downloaded, two system properties will need to be updated. These properties are known as environment variables, and they will be used to associate keywords with file paths. This allows the system to know where Java is installed, so that it can run the software. Add a System Environment Variable named <strong><em>JAVA_HOME </em></strong>and set it to the file path of the Java install. Then, add the text <strong><em>$JAVA_HOME/bin </em></strong>to the system path variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eqgGyeyXr_1ElZHW5EW9lQ.png" /><figcaption>The menu on the left can be accessed by searching for ‘Environment Variables’</figcaption></figure><h3>Installing the Maven Build Tool</h3><p>The next step is to install a piece of software known as Maven. This is a build tool — among other utilities, it is used to configure the way that the project is compiled, the way that the application is named and versioned, and to import additional libraries of code. It can be downloaded from <a href="https://maven.apache.org/download.cgi">https://maven.apache.org/download.cgi</a>, and requires the configuration of two additional environment variables. The user variable <strong><em>MAVEN_HOME </em></strong>must be set to the path of the Maven install, and the text <strong><em>$MAVEN_HOME/bin </em></strong>should be added to the system <strong><em>Path </em></strong>variable.</p><p>Once Maven has been installed, the application can be created by running the following command from the Command Prompt:</p><pre>mvn archetype:generate -DgroupId=com.example -DartifactId=application-name -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false</pre><h3>Installing the IntelliJ Integrated Development Environment</h3><p>The last step is to download the tool that is used to read and edit code, called an Integrated Development Environment (IDE). There is a robust and free product known as IntelliJ Community Edition that can be downloaded from <a href="https://www.jetbrains.com/idea/download/?var=1&amp;section=windows"><em>https://www.jetbrains.com/idea/download/?var=1&amp;section=windows</em></a><em>.</em></p><p>Once IntelliJ is running, open the project directory titled <em>application-name</em>. A few additional steps may be necessary to make sure that IntelliJ is configured for the version of Java that is installed. Start by selecting <strong><em>File</em></strong>, <strong><em>Project Structure </em></strong>and validating that the SDK and language level match the desired version of Java. In this case, Java 17.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n9Y9enXmZ2sPj76RjvzyUw.png" /></figure><p>Navigate to the <strong><em>Modules </em></strong>tab, and make sure the <em>Language level </em>is set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kbfgShpVY8dVdS33ZrfHhA.png" /></figure><p>Finally, select <strong><em>File</em></strong><em>,</em> <strong><em>Settings</em></strong>, (<strong><em>Build, Execution, Deployment</em></strong>), <strong><em>Compiler </em></strong>and <strong><em>Java Compiler</em></strong>. Make sure that the <em>Target bytecode version </em>is set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fuXitqXcV6rLItgEabKeDg.png" /></figure><p>Code can be written in the <em>App.java </em>file. The existing template may have to be expanded by selecting the small arrow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o7EBBfFgYt90yxXVURlpRg.png" /></figure><p>Now, lines of code can be added in between the braces on lines ten and twelve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mx6F8P_nSaFKcW6SECJPqw.png" /></figure><p>The code can be compiled <em>and </em>executed by pressing the green button on line nine, and the output appears at the bottom of the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DjtcLuzUG8bOF4ZGaQTLg.png" /></figure><h3>Summary</h3><ul><li>The Java programming language was installed and two system properties called environment variables were configured.</li><li>The Maven build tool was installed and two environment variables were configured.</li><li>A Java application was created by running a Maven command from the command line.</li><li>The IntelliJ code editor was installed, and the Java version being used by IntelliJ was validated in several places.</li><li>The application code was expanded in the editor and executed.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0fa8f792e28" width="1" height="1" alt=""><hr><p><a href="https://medium.com/introduction-to-application-development-with-java/getting-started-with-application-development-c0fa8f792e28">Configuring a Java Development Environment</a> was originally published in <a href="https://medium.com/introduction-to-application-development-with-java">Introduction to Application Development with Java</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>