<?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[Stories by 24blognews on Medium]]></title>
        <description><![CDATA[Stories by 24blognews on Medium]]></description>
        <link>https://medium.com/@24blognewsindia?source=rss-ae31514a0caa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by 24blognews on Medium</title>
            <link>https://medium.com/@24blognewsindia?source=rss-ae31514a0caa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 18 May 2026 06:31:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@24blognewsindia/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Java Addition of Array Elements]]></title>
            <link>https://medium.com/@24blognewsindia/java-addition-of-array-elements-8a7ae02493fa?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a7ae02493fa</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Tue, 27 Feb 2024 06:18:18 GMT</pubDate>
            <atom:updated>2024-02-27T06:18:18.696Z</atom:updated>
            <content:encoded><![CDATA[<p>Below example demonstrates the addition of integer numbers stored as elements in an Array. To achieve such, a for loop is created. The loop switches the index wise values of the array and places them into the variable name sumOfElementsOfIntegerArray one by one. With += plus and equal to operator every element is first get add up with initial variable value and then placed.</p><p>class ArrayElementsSum {</p><p>public static void main(String[] args){</p><p>int[] arrayOfIntegers = {2,9,8,56,6};</p><p>int sumOfElementsOfIntegerArray = 0;</p><p>for(int i = 0; i &lt; arrayOfIntegers.length; i++) {</p><p>sumOfElementsOfIntegerArray += arrayOfIntegers[i];</p><p>}</p><p>System.out.println(“Sum of integer elements of array is : “ + sumOfElementsOfIntegerArray);</p><p>}</p><p>}</p><p>visit below for more such examples : — <a href="https://www.roseindia.net/java/">https://www.roseindia.net/java/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*23sRi_BSZoO07ladFQapRw.jpeg" /><figcaption><a href="https://www.roseindia.net/java/">https://www.roseindia.net/java/</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a7ae02493fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java String data reversing]]></title>
            <link>https://medium.com/@24blognewsindia/java-string-data-reversing-52a45f67e2ff?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/52a45f67e2ff</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Tue, 27 Feb 2024 05:44:46 GMT</pubDate>
            <atom:updated>2024-02-27T05:44:46.859Z</atom:updated>
            <content:encoded><![CDATA[<p>Below code demonstrates relocation of the indexes of string data. All the string data is reversed, to achieve such, a for loop is used, in which every single character is switched from the string variable mainStringData and placed into the variable backwordIndexedStringData. Loop automatically terminates when the condition defined fails.</p><p>class StringDataIndexrelocation {</p><p>public static void main(String[] args) {</p><p>String mainStringData = “Evil engages us when we least expect it”, backwordIndexedStringData = “”;</p><p>for(int i = 0; i &lt; mainStringData.length(); i++) {</p><p>backwordIndexedStringData = mainStringData.charAt(i) + backwordIndexedStringData;</p><p>}</p><p>System.out.println(backwordIndexedStringData);</p><p>}</p><p>}</p><p>visit below for more learning: — <a href="https://www.roseindia.net/java/">https://www.roseindia.net/java/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtiJFXZ1lwUK27OTkO2w_A.jpeg" /><figcaption><a href="https://www.roseindia.net/java/">https://www.roseindia.net/java/</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52a45f67e2ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Counting sentence words in java]]></title>
            <link>https://medium.com/@24blognewsindia/counting-sentence-words-in-java-dde5a9552f2e?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/dde5a9552f2e</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Mon, 26 Feb 2024 06:31:00 GMT</pubDate>
            <atom:updated>2024-02-26T06:31:00.648Z</atom:updated>
            <content:encoded><![CDATA[<p>A sentence is a collection of words, example below illustrates counting total number of words with .length method in java. Another method is utilized called .split() with string argument \\s so the length method can count words separately.</p><p>class WordsCount {</p><p>public static void main(String[] args){</p><p>String words = “I cant fight an enemy, which I don’t understand”;</p><p>int wordsCount = words.split(“\\s”).length;</p><p>System.out.println(wordsCount);</p><p>}</p><p>}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*8vF---HszNeLTp_pqgTvUQ.jpeg" /><figcaption><a href="https://www.roseindia.net/java/">https://www.roseindia.net/java/</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dde5a9552f2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Integers in Java]]></title>
            <link>https://medium.com/@24blognewsindia/adding-integers-in-java-e6e11f03112a?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6e11f03112a</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Mon, 26 Feb 2024 06:00:06 GMT</pubDate>
            <atom:updated>2024-02-26T06:00:06.344Z</atom:updated>
            <content:encoded><![CDATA[<p>In Java adding two integers can be done with single plus sign + operator, however in the code below reading of user inputs and assigning them to variables is done with proper illustrations.</p><p>Getting user input read is done with a predefined method nextLn(). This method is executed with an Object instance of an imported class called Scanner. This has to be done as any predefined method inside a class can only be accessed with an object instance of that same class.</p><p>import java.util.Scanner; // Scanner class is getting imported in the code with import keyword</p><p>class Addition {<br> public static void main(String[] args){</p><p>int firstUserInput, secondUserInput, sumOfInputs;</p><p>Scanner scannerClassObject = new Scanner(System.in); // Creating a Scanner class object<br> System.out.println(“Type first number: “);<br> firstUserInput = scannerClassObject.nextInt(); // Here user first input is read and get assigned into variable firstUserInput;</p><p>System.out.println(“Type second number: “);<br> secondUserInput = scannerClassObject.nextInt(); // Second user input is getting read and specified</p><p>sumOfInputs = firstUserInput + secondUserInput; // with plus sign operator both input values are added up and the value is assigned into the variable sumOfInputs</p><p>System.out.println(“Sum of both inputs is :” + sumOfInputs);<br> <br>}<br>}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*ZiTqvhTe7ML-QcM-NWnCvQ.jpeg" /><figcaption><a href="https://www.roseindia.net/java/">https://www.roseindia.net/java/</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6e11f03112a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Table Code with Multi-Dimensional Array]]></title>
            <link>https://medium.com/@24blognewsindia/java-table-code-with-multi-dimensional-array-ccc0938fcd38?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccc0938fcd38</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Fri, 15 Dec 2023 11:02:21 GMT</pubDate>
            <atom:updated>2023-12-15T11:02:21.839Z</atom:updated>
            <content:encoded><![CDATA[<p>In the code below, two-dimensional array is used to construct a code for a table of number 10.</p><p>In the code loop inside the loop and a ++ early value increment operator is used.</p><p>First a two-dimensional array is initialized with two square brackets. Now in the loops, first the initialized variable values of i and j are checked according to the conditions defined in the middle portion of the loop and then the control goes to next statement System.out.println(); and after that to the ++operator which increases the values of the variable by 1. The loop terminates when the condition defined returns boolean value false.</p><p>In the loop .length method returns the length of array.</p><p>public class myTableClass {</p><p>public static void main(String[] args) {</p><p>int[][] myNumbers = { {1, 2, 3, 4,5,6,7},{8,9,10}};</p><p>for (int i = 0; i &lt; myNumbers.length; ++i) {</p><p>for(int j = 0; j &lt; myNumbers[i].length; ++j) {</p><p>System.out.println(“10 * “ + myNumbers[i][j] + “ = “ + 10 * myNumbers[i][j]);</p><p>}</p><p>}</p><p>}</p><p>}</p><p>After compiling the above code, following out put shows on to console</p><p>10 * 1 = 10</p><p>10 * 2 = 20</p><p>10 * 3 = 30</p><p>10 * 4 = 40</p><p>10 * 5 = 50</p><p>10 * 6 = 60</p><p>10 * 7 = 70</p><p>10 * 8 = 80</p><p>10 * 9 = 90</p><p>10 * 10 = 100</p><p>Keep coding and visit below for more learning</p><p><a href="https://www.roseindia.net/java/index.shtml">https://www.roseindia.net/java/index.shtml</a> <a href="https://www.roseindia.net/java/index.shtml">#table #coding</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pl7FIFNCvmmIYYvkpCxyxQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccc0938fcd38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Arrays]]></title>
            <link>https://medium.com/@24blognewsindia/java-arrays-f545bdc7c982?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/f545bdc7c982</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Fri, 08 Dec 2023 11:37:02 GMT</pubDate>
            <atom:updated>2023-12-08T11:37:02.804Z</atom:updated>
            <content:encoded><![CDATA[<p>In Programming Arrays represents the storage points of multiple values of same data type. To store more than one value of same data type, multiple variables are needed to be initialized. A single array can sort the above issue by storing all values in it. Every value in array is assigned a storage position called indexes in array, later to access that value.</p><p>Here is the syntax of creating an array.<br>Variable_dataType []; So, any datatype variable can be transformed in to an array by just placing square brackets along side with the data type. For example <br>String [] birds = {“crow”, “pigeon”, “ostrich”, “parrot”, “sparrow”};<br>Now every value position or index allocation in an array starts with 0 and goes on<br>Each bird name in the string array birds can only be accessed with specific index positions allotted. For example, to access bird name ostrich following syntax works.<br>System.out.println(“Bird at third index of array birds is : “ + birds[2] ); The thirds location in an array is counted as ,0, 1, 2.<br>This how a value in an array gets accessed also with the following syntax value can be altered too.<br>birds[3] = “eagle”;<br>System.out.println(“Now the value at third index of array birds is replaced with eagle:” + birds[3]);<br>All the multiple values allocated into an array, occupies the array volume. With the syntax below the total length of an array can be find out.<br>System.out.println(birds.length); .length() property just counts all the indexes allocations, it’s like counting all the number of safe storages allocated to customers near a ship yard. Here in the array the total length comes out to be 5 which is counted as 0,1,2,3,4;<br>Run the below code and see what happens<br>public class myArray {<br> public static void main(String[] args) {<br>String [] birds = {“crow”, “pigeon”, “ostrich”, “parrot”, “sparrow”};</p><p>System.out.println(“Bird at third index of array birds is : “ + birds[2] );</p><p>birds[3] = “eagle”;<br>System.out.println(birds.length); <br>}<br>}<br> <br>Console shows following output<br>Bird at third index of array birds is : ostrich<br>5</p><p>It’s time to go dimensional, when an array goes dimensional means, now multiple arrays with equivalent data type values can be stored and accessed through a single array instance. And accessing the values of such array is like switching to cells of a row and column in MS Excel.<br>Here is an example of two-dimensional array below, observe each array along with the values are stored inside a single array with its own set of curly braces. <br>public class narayan {<br> public static void main(String[] args) {</p><p>String[][] godIncarnations = {{“jesus”, “prophet”, “mohammed”},{“ram”, “narayan”, “mahadev”}};<br>System.out.println(“incarnated name of god at the second position inside first array : “ + godIncarnations[0][1]); // <br>System.out.println(“incarnated name of god at the third position inside second array : “ + godIncarnations[1][2]);<br> }<br>}<br>After successful compilation console shows following output<br> <br>incarnated name of god at the second position inside first array : prophet<br>incarnated name of god at the third position inside second array : mahadev</p><p>Let’s create a table program with array<br>public class main {<br> public static void main(String[] args) {<br>int[] numbers = {1,2,3,4,5,6,7,8,9,10};<br>int y = 1;<br>do{<br>System.out.println(“10 * “ + numbers[y-1] + “ = “ + 10*numbers[y-1]);<br>y++;</p><p>}while(y&lt;=10);</p><p>}<br>}<br>Console shows following output<br>10 * 1 = 10<br>10 * 2 = 20<br>10 * 3 = 30<br>10 * 4 = 40<br>10 * 5 = 50<br>10 * 6 = 60<br>10 * 7 = 70<br>10 * 8 = 80<br>10 * 9 = 90<br>10 * 10 = 100</p><p>Keep coding and visit below for more practice tutorials<br><a href="https://www.roseindia.net/java/">https://www.roseindia.net/java/</a> #javaarrays #arrays #coding</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EzccH0cA9HP6uOUp0lHqMw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f545bdc7c982" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Scanner class and Exception catchers Try, Catch, Finally]]></title>
            <link>https://medium.com/@24blognewsindia/java-scanner-class-and-exception-catchers-try-catch-finally-eaeedc81b888?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaeedc81b888</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Mon, 27 Nov 2023 10:03:18 GMT</pubDate>
            <atom:updated>2023-11-27T10:03:18.209Z</atom:updated>
            <content:encoded><![CDATA[<p>Scanner class in java comes with java.util package, facilitates reading data value input by the user. Data value can be of different formats. So, to read the input, several methods as per the type of data are defined inside scanner class. Below is the list of methods used with an instance of Scanner Class Object.</p><p>Method Description</p><p>nextBoolean() A boolean value gets read</p><p>nextByte() An input byte data gets read</p><p>nextDouble() An input double data gets read</p><p>nextFloat() An input float data gets read</p><p>nextInt() An input Integer data gets read</p><p>nextLine() An input float data gets read</p><p>nextLong() An long byte data gets read</p><p>nextShort() An input short data gets read</p><p>When an input data gets read, with the datatype read method, value is validated, and when input value data type validation fails, error or exception is thrown or generated by the java compiler.</p><p>In the code an instance of Scanner class object is created with name myScannerClassObject, so to use the class methods.</p><p>To maintain code stability exception catcher’s try and catch are defined. In the example below three different user input data type value are read by the scanner class methods. nextLine(), .nxtInt() and .nextDouble(). Whenever any input data mismatches its field data type, exception gets throwed, and try and catch works on the exception. In cases of exceptions, finally keyword command still gets executed regardless try and catch exception catcher’s work.</p><p>import java.util.Scanner; // bringing scanner class interface</p><p>class narayan {</p><p>public static void main(String[] args) {</p><p>try{</p><p>Scanner myScannerClassObject = new Scanner(System.in);</p><p>System.out.println(“Enter username”);</p><p>String stringVariable = myScannerClassObject.nextLine(); // Read user input</p><p>Integer myInt = myScannerClassObject.nextInt();</p><p>Double myDouble = myScannerClassObject.nextDouble();</p><p>System.out.println(“Username is: “ + stringVariable); // Output user input</p><p>System.out.println(“Roll No. is: “ + myInt); // Output user input</p><p>System.out.println(“Average Speed is: “ + myDouble + “m/s”); // Output user input</p><p>} catch (Exception e) {</p><p>System.out.println(“Data type mismatch”);</p><p>} finally {</p><p>System.out.println(“type correct data type value”);</p><p>}</p><p>}</p><p>}</p><p>When the code is compiled three user inputs are asked, go ahead and compile it. And visit below link for more practice tutorials.</p><p><a href="https://www.roseindia.net/java/?fbclid=IwAR3q-giO8P21XjER7K2NmYyeE1NmWvBEHwa4syLXYwrPlzknyOcYo2GQ-H8">https://www.roseindia.net/java/</a> <a href="https://www.facebook.com/hashtag/javaexceptions?__eep__=6&amp;__cft__[0]=AZVcQHrmkjz5JSeUNY_TC2pb2gXzOIOONc73eK4bNMZf_CDDpcwI1PdXSz8_1Db7zC4TTFWgrU7UqIRydGwzBw2I_jPEaOiTGmnuKC3N2vzaF9lxE3zwM-caV1hmyrhDmGr0T4F138o_fRnqWAiRBE_u583bby3rII2RqQ2RdixtVw&amp;__tn__=*NK-R">#javaexceptions</a> <a href="https://www.facebook.com/hashtag/javascannerclass?__eep__=6&amp;__cft__[0]=AZVcQHrmkjz5JSeUNY_TC2pb2gXzOIOONc73eK4bNMZf_CDDpcwI1PdXSz8_1Db7zC4TTFWgrU7UqIRydGwzBw2I_jPEaOiTGmnuKC3N2vzaF9lxE3zwM-caV1hmyrhDmGr0T4F138o_fRnqWAiRBE_u583bby3rII2RqQ2RdixtVw&amp;__tn__=*NK-R">#javascannerclass</a> <a href="https://www.facebook.com/hashtag/coding?__eep__=6&amp;__cft__[0]=AZVcQHrmkjz5JSeUNY_TC2pb2gXzOIOONc73eK4bNMZf_CDDpcwI1PdXSz8_1Db7zC4TTFWgrU7UqIRydGwzBw2I_jPEaOiTGmnuKC3N2vzaF9lxE3zwM-caV1hmyrhDmGr0T4F138o_fRnqWAiRBE_u583bby3rII2RqQ2RdixtVw&amp;__tn__=*NK-R">#coding</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZecgGwsojYPk9iv8A1CdFQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaeedc81b888" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Abstraction]]></title>
            <link>https://medium.com/@24blognewsindia/java-abstraction-5be3166d60d5?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/5be3166d60d5</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Fri, 24 Nov 2023 11:24:00 GMT</pubDate>
            <atom:updated>2023-11-24T11:24:00.858Z</atom:updated>
            <content:encoded><![CDATA[<p>In Java Object Oriented Programming, introducing abstraction inside the java code, makes a java code maintainable and more simplified. Abstraction basically coverups some internal classes and object related codes which makes the code invisible to users, this enhances the security of the code as well. With abstraction a coder can actually accumulate its total focus on the purpose of class objects rather than how the object is performing the quest.</p><p>Abstraction can be implemented in two shots, first one using abstract non access modifier keyword and the second one is with interfaces.</p><p>When a class is declared abstract, its attributes and itself access gets hindered to other classes. All the abstract methods of the class are accessible inside the class only, also abstract methods of an abstract class do not possess any code or in simple terms method does not contain any body. All the code will be defined inside the class that inherits the abstract class.</p><p>Interaction to abstract classes gets achieved only with inheritance using extend keyword as demonstrated in below code.</p><p>abstract class Creature {</p><p>public abstract void creatureSound();</p><p>public void meditating() {</p><p>System.out.println(“hmmm hoommmh”);</p><p>}</p><p>}</p><p>Creature myPet = new Creature();</p><p>//Now an object of class Creature, going to generate compile time error, as the class is abstract in nature</p><p>Now as stated above with inheritance, access to abstract class is possible. Check below code, how its done</p><p>abstract class Creature {</p><p>public abstract void myPetSounds();</p><p>public void meditating() {</p><p>System.out.println(“while mediatiting my pet buzo chanting sounds like ohmmmohhhmhmh”);</p><p>}</p><p>}</p><p>//Now an object of class Creature, gonna generate compile time error</p><p>//forming a Subclass inherited from class Creature</p><p>class Pet extends Creature {</p><p>public void myPetSounds() {</p><p>System.out.println(“when buzo shouts it sounds hears like wow wwoow”);</p><p>}</p><p>}</p><p>class narayan {</p><p>public static void main(String[] args){</p><p>Pet myPet = new Pet(); // creating a Pet class object</p><p>myPet.meditating();</p><p>myPet.myPetSounds();</p><p>}</p><p>}</p><p>After compilation successfully following output the console shows.</p><p>while mediatiting my pet buzo chanting sounds like ohmmmohhhmhmh</p><p>when buzo shouts it sounds hears like wow wwoow</p><p>Second way of applying abstraction into java code is with Interfaces, Interfaces are predefined abstract classes in java. Now same procedure of accessing goes on except instead of using “extend” keyword, “implement” keyword gets placed for a subclass to inherit the abstract parent class. Check out the code below, all is demonstrated.</p><p>interface Creature {</p><p>public void myPetSounds(); // interface methods doesnot possess body</p><p>public void speed();</p><p>}</p><p>class Pet implements Creature {</p><p>public void myPetSounds() {</p><p>System.out.println(“when buzo shouts it sounds hears like wow wwoow”);</p><p>}</p><p>public void speed () {</p><p>System.out.println(“buzo runs with incredible pace”); // defining body of interface class speed method</p><p>}</p><p>}</p><p>class narayan {</p><p>public static void main(String[] args){</p><p>Pet myPet = new Pet(); // creating a Pet class object</p><p>myPet.speed();</p><p>myPet.myPetSounds();</p><p>}</p><p>}</p><p>keep coding and visit below for more practice tutorials on java coding</p><p><a href="https://www.roseindia.net/java/index.shtml?expand_article=1">https://www.roseindia.net/java/index.shtml?expand_article=1</a> #JavaAbstraction #Java #coding</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8tyfKHDUI6-DXoZkIu6gQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5be3166d60d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Classes]]></title>
            <link>https://medium.com/@24blognewsindia/java-classes-96f2e0cae893?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/96f2e0cae893</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Thu, 23 Nov 2023 12:05:58 GMT</pubDate>
            <atom:updated>2023-11-23T12:05:58.127Z</atom:updated>
            <content:encoded><![CDATA[<p>Classes in java can be predefined and can also be built. Predefined ones are numerous in numbers inside the java packages. Classes that are built by the coders while coding are termed as user defined java classes. Here, the ways, security and accessibility with which java classes are built while coding is explained.</p><p>All the coding is starts and encoded inside a java class. In the below code user defined two classes are built, FirstClass and First_SubClass. Now the noticeable point here is classes can be built inside a class also to make code more understandable and efficient.</p><p>Now every java code written must have a main class with name exactly of the java file has. Both classes created in the code have attributes one integer variables alpha and beta. Now any class attribute or member can be accessed with class object objects support, so two class objects with name myFirstClassObject and myFirstSubClassObject are created in the code. Check out the syntax for the class object generation, while generating subclass object, the need of FirstClass object is imperative.</p><p>Below code basically demonstrates how to create inner classes</p><p>class FirstClass {</p><p>int alpha = 20;</p><p>class First_SubClass {</p><p>int beta = 30;</p><p>}</p><p>}</p><p>public class narayan {</p><p>public static void main(String[] args){</p><p>FirstClass myFirstClassObject = new FirstClass();</p><p>FirstClass.First_SubClass myFirstSubClassObject = myFirstClassObject.new First_SubClass();</p><p>System.out.println(“sub class integer variable beta value is : “ + myFirstSubClassObject.beta + “\n” + “First class integer variable alpha value is : “ + myFirstClassObject.alpha);</p><p>}</p><p>}</p><p>After successful compilation</p><p>sub class integer variable beta value is : 30</p><p>First class integer variable alpha value is : 20</p><p>In the code, My First_SubClass is an inner class , and write now not above it is declared as a regular class. The thing is coder can restrict class or its attributes and members access by declaring classes as private or protected. Check out the code below, how such restriction is achieved.</p><p>Here in the code below the inner class is declared as private and prohibiting any outside class object access into inner class attributes and methods.</p><p>class FirstClass {</p><p>int alpha = 20;</p><p>private class First_SubClass {</p><p>int beta = 30;</p><p>}</p><p>}</p><p>public class narayan {</p><p>public static void main(String[] args){</p><p>FirstClass myFirstClassObject = new FirstClass();</p><p>FirstClass.First_SubClass myFirstSubClassObject = myFirstClassObject.new First_SubClass();</p><p>System.out.println(“sub class integer variable beta value is : “ + myFirstSubClassObject.beta + “\n” + “First class integer variable alpha value is : “ + myFirstClassObject.alpha);</p><p>}</p><p>}</p><p>During compilation the java compiler shouts out the following error. This compiler objection is because access to an inner private declared class is not allowed through any outer class.</p><p>narayan.java:13: error: FirstClass.First_SubClass has private access in FirstClass</p><p>FirstClass.First_SubClass myFirstSubClassObject = myFirstClassObject.new First_SubClass();</p><p>^</p><p>narayan.java:13: error: FirstClass.First_SubClass has private access in FirstClass</p><p>FirstClass.First_SubClass myFirstSubClassObject = myFirstClassObject.new First_SubClass();</p><p>^</p><p>2 errors</p><p>To access an inner class, the object instance of the super class is needed. But this can be dodged, with declaring the inner class static, as demonstrated below.</p><p>class FirstClass {</p><p>int alpha = 20;</p><p>static class First_SubClass {</p><p>int beta = 30;</p><p>}</p><p>}</p><p>public class narayan {</p><p>public static void main(String[] args){</p><p>// no need for an super class object instance</p><p>// FirstClass myFirstClassObject = new FirstClass();</p><p>FirstClass.First_SubClass myFirstSubClassObject = new FirstClass.First_SubClass();</p><p>System.out.println(“sub class integer variable beta value is : “ + myFirstSubClassObject.beta + “\n”);</p><p>}</p><p>}</p><p>After successful compilation following output shows up</p><p>sub class integer variable beta value is : 30</p><p>Inner class have an advantage over super classes as they can access attributes and members of their super classes, as mentioned below.</p><p>class FirstClass {</p><p>String gamma = “om namo bhagvate vasudevaaye”;</p><p>class First_SubClass {</p><p>public String myFirstSubClassMethod(){</p><p>return gamma;</p><p>}</p><p>}</p><p>}</p><p>public class narayan {</p><p>public static void main(String[] args){</p><p>FirstClass myFirstClassObject = new FirstClass();</p><p>FirstClass.First_SubClass myFirstSubClassObject = myFirstClassObject.new First_SubClass();</p><p>System.out.println(“Super Class String variable gamma value : “ + myFirstSubClassObject.myFirstSubClassMethod());</p><p>}</p><p>}</p><p>After successful compilation following output comes up to console</p><p>Super Class String variable gamma value : om namo bhagvate vasudevaaye</p><p>Keep coding and visit the below link for more practice tutorials</p><p><a href="https://www.roseindia.net/java/index.shtml">https://www.roseindia.net/java/index.shtml</a> #javaclasses #javacoding #javatutorials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFYKCby4fNPAzfwqigbxbw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96f2e0cae893" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java read a text file line by line]]></title>
            <link>https://medium.com/@24blognewsindia/java-read-a-text-file-line-by-line-8afcdb5268b9?source=rss-ae31514a0caa------2</link>
            <guid isPermaLink="false">https://medium.com/p/8afcdb5268b9</guid>
            <dc:creator><![CDATA[24blognews]]></dc:creator>
            <pubDate>Wed, 22 Nov 2023 10:19:39 GMT</pubDate>
            <atom:updated>2023-11-22T10:19:39.483Z</atom:updated>
            <content:encoded><![CDATA[<p>With the JAVA SDK environment, packages come, inside packages there are numerous classes and methods inside the classes, which perform specific roles inside a java code. There is a package name java.io inside which two classes are built called BufferedReader and Scanner, these classes have roles in analysing input data such as text, characters and numbers.<br>Here BufferedReader class will be explained for the purpose of reading text from file line by line. Buffered reader class is considered more effective for the above purpose as it has this unique way of reading data, which is, during the reading process, only portion of data is selected and buffered first. <br>First java. java.io.BuferedReader package is brought into the code with the import keyword.<br>Inside the code buffering size can be allotted, if not default size 8192 characters will be initiated.<br>Go through each line of code below and see what’s happening, the output content is size limited as specified in the character array, the real content in file matrix.txt is much more.</p><p>import java.io.FileReader;<br>import java.io.BufferedReader;</p><p>class narayan {<br>public static void main(String[] args){<br>char[] array_of_characters = new char[120]; // an array creation of 120 character size limit</p><p>try {<br>FileReader aFileReaderClassObject = new FileReader(“matrix.txt”); // creating an object of FileReader class<br>BufferedReader aBufferedReaderClassObject = new BufferedReader(aFileReaderClassObject); // creating a Buffered Reader class object and placing FileReader class object inside the parentheses value section of Buffered Reader Class object aBufferedReaderClassObject</p><p>aBufferedReaderClassObject.read(array_of_characters);<br>System.out.println(“Data content of file matrix.txt is”);<br>System.out.println(array_of_characters);</p><p>}</p><p>catch(Exception some_exception){<br>some_exception.getStackTrace();<br>}</p><p>}<br>}<br>After successful compilation following output comes up<br>Data content of file matrix.txt is<br>Dialogues from The Matrix:</p><p>“Welcome to the real world.” — Morpheus<br>Morpheus says this to Neo after he takes the red</p><p>Keep coding and visit the below link for more understanding and practice tutorials<br><a href="https://www.roseindia.net/java/example/java/io/java-BufferedReader.shtml?expand_article=1">https://www.roseindia.net/java/example/java/io/java-BufferedReader.shtml?expand_article=1</a> #javaBufferedReader #javatextfilereader #javacoding</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sqtih34hCSlakl7DvlxmCw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8afcdb5268b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>