<?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: Mohamed Ajmal</title>
    <description>The latest articles on DEV Community by Mohamed Ajmal (@mohamed_ajmal_2).</description>
    <link>https://dev.to/mohamed_ajmal_2</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%2F3614850%2Fd5a68601-76bd-4aa7-ab0e-8e5f2dc9051e.png</url>
      <title>DEV Community: Mohamed Ajmal</title>
      <link>https://dev.to/mohamed_ajmal_2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohamed_ajmal_2"/>
    <language>en</language>
    <item>
      <title>Collections in Java.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Thu, 04 Jun 2026 07:31:10 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/collections-in-java-5h8l</link>
      <guid>https://dev.to/mohamed_ajmal_2/collections-in-java-5h8l</guid>
      <description>&lt;p&gt;Java Collection Framework (JCF) is a set of classes and interfaces that provide ready-made data structures to store and manipulate groups of objects efficiently. &lt;/p&gt;

&lt;p&gt;Java provides collection interfaces like List, Set, Map, and Queue, with ready-made classes such as ArrayList, HashSet, HashMap, and PriorityQueue, so you don’t have to write data-handling code from scratch. The Collection Framework improves productivity by making code more reusable, maintainable and faster to develop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Core Components of the Framework:&lt;/strong&gt;&lt;br&gt;
The framework is structurally broken down into three main areas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interfaces:&lt;/strong&gt; Abstract data types that define the standard behaviors of different collections.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Classes (Implementations):&lt;/strong&gt; Concrete, ready-to-use data structures that implement those interfaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Algorithms:&lt;/strong&gt; Polymorphic, static utility methods to perform complex routines like sorting and searching.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvj410fvh1z5co90kytbs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvj410fvh1z5co90kytbs.png" alt=" " width="323" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features of Java Collection Framework&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Provides ready-to-use data structures (e.g., Array-list, Hash-Set, Hash-map).

Offers interfaces (Collection, List, Set, Map, Queue) to define standard behaviors.

Supports dynamic resizing, unlike arrays with a fixed size.
Includes algorithms (sorting, searching, iteration) via the Collections utility class.

Improves code re-usability and performance by reducing boilerplate code.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>java</category>
    </item>
    <item>
      <title>Java File Handling.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Wed, 03 Jun 2026 06:17:30 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/java-file-handling-6oe</link>
      <guid>https://dev.to/mohamed_ajmal_2/java-file-handling-6oe</guid>
      <description>&lt;p&gt;In Java, file handling means working with files like creating them, reading data, writing data or deleting them. It helps a program save and use information permanently on the computer.&lt;/p&gt;

&lt;p&gt;Why File Handling is Required?&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;To store data permanently instead of keeping it only in memory.
To read and write data from/to files for later use.
To share data between different programs or systems.
To organize and manage large data efficiently.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To support file handling, Java provides the File class in the java.io package.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operations&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;*&lt;em&gt;Create a File *&lt;/em&gt;- In order to create a file in Java, you can use the createNewFile() method. If the file is successfully created, it will return a Boolean value true and false if the file already exists.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Write to a File&lt;/strong&gt; - We use the FileWriter class along with its write() method in order to write some text to the file. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Read from a File&lt;/strong&gt; - In Java, the read() method is used with classes like FileReader or InputStream to read data from a file one character or byte at a time.&lt;/p&gt;

&lt;p&gt;It returns an integer value representing the character or byte read.When the end of the file is reached, the method returns -1 indicating no more data is available.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;canRead a File&lt;/strong&gt; - canRead() check if the file is readable.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;5.&lt;strong&gt;canWrite a File&lt;/strong&gt; - canWrite() checks whether the file can be written to by the program.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Existance of a File&lt;/strong&gt; - exists() checks whether the specified file or directory exists on the file system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Getting a path&lt;/strong&gt; - getAbsolutePath() returns the full path of the file or directory in the file system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Delete a File&lt;/strong&gt; - We use the delete() method in order to delete a file.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>java</category>
    </item>
    <item>
      <title>Exception Handling in Java.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Fri, 22 May 2026 06:07:15 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/exception-handling-in-java-4lfl</link>
      <guid>https://dev.to/mohamed_ajmal_2/exception-handling-in-java-4lfl</guid>
      <description>&lt;p&gt;Exception Handling in Java is a mechanism used to handle both compile-time (checked) and runtime (unchecked) exceptions, allowing a program to continue execution smoothly even in the presence of errors.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Handles abnormal conditions that occur during program execution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Helps maintain program stability by preventing unexpected termination.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;class ExceptionDemo{&lt;br&gt;
    public static void main(String[] args) {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    int i = 10;
    int j = 0;

    try {
        int ans = i / j;
        System.out.println("Answer: " + ans);
    } catch (ArithmeticException e){
        System.out.println("Error: Division by 0!");
    } 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Output&lt;/p&gt;

&lt;p&gt;Error: Division by 0!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>java</category>
    </item>
    <item>
      <title>String Methods in Java.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Wed, 20 May 2026 07:19:31 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/string-methods-in-java-ea3</link>
      <guid>https://dev.to/mohamed_ajmal_2/string-methods-in-java-ea3</guid>
      <description>&lt;p&gt;Some Important String Methods in Java: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;length()&lt;/strong&gt; - Returns the length of the string.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;EX:&lt;br&gt;
String name = "Ajmal";&lt;br&gt;
System.out.println(name.length());&lt;br&gt;
O/P = 5&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;charAt()&lt;/strong&gt; - Returns character at a specific index.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;EX:&lt;br&gt;
String name = "Ajmal";&lt;br&gt;
System.out.println(name.charAt(0));&lt;br&gt;
O/P = A&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;toLowerCase()&lt;/strong&gt; - Converts string to Lowercase.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;EX:&lt;br&gt;
String name = "AJMAL";&lt;br&gt;
System.out.println(name.toLowerCase());&lt;br&gt;
O/P = ajmal&lt;/p&gt;

&lt;p&gt;4.&lt;strong&gt;toUpperCase()&lt;/strong&gt;- Converts string to uppercase.&lt;/p&gt;

&lt;p&gt;EX:&lt;br&gt;
String name = "ajmal";&lt;br&gt;
System.out.println(name.toUpperCase());&lt;br&gt;
O/P = AJMAL&lt;/p&gt;

&lt;p&gt;5.&lt;strong&gt;equals()&lt;/strong&gt; - Compares two strings.&lt;/p&gt;

&lt;p&gt;EX: &lt;br&gt;
String a = "Ajmal";&lt;br&gt;
String b = "Ajmal";&lt;br&gt;
System.out.println(a.equals(b));&lt;br&gt;
O/P = true.&lt;/p&gt;

&lt;p&gt;6.&lt;strong&gt;equalsIgnoreCase()&lt;/strong&gt; - Compares strings ignoring case.&lt;/p&gt;

&lt;p&gt;EX:&lt;br&gt;
String a = "ajmal";&lt;br&gt;
String b = "AJMAL";&lt;br&gt;
System.out.println(a.equalsIgnoreCase(b));&lt;br&gt;
O/P = true&lt;/p&gt;

&lt;p&gt;7.&lt;strong&gt;contains()&lt;/strong&gt; - Checks whether string contains given text.&lt;/p&gt;

&lt;p&gt;EX:&lt;br&gt;
String text = "Welcome Ajmal";&lt;br&gt;
System.out.println(text.contains("Ajmal"));&lt;br&gt;
O/P = true&lt;/p&gt;

&lt;p&gt;8.&lt;strong&gt;startsWith()&lt;/strong&gt; - Checks starting characters.&lt;/p&gt;

&lt;p&gt;EX:&lt;br&gt;
String name = "Java Programming";&lt;br&gt;
System.out.println(name.startsWith("Java"));&lt;br&gt;
O/P = true&lt;/p&gt;

&lt;p&gt;9.&lt;strong&gt;endsWith()&lt;/strong&gt; - Checks ending characters.&lt;/p&gt;

&lt;p&gt;EX:&lt;br&gt;
String name = "Ajmal.pdf";&lt;br&gt;
System.out.println(name.endsWith(".pdf"));&lt;br&gt;
O/P = true.&lt;/p&gt;

&lt;p&gt;10.** substring()** - Extracts part of string.&lt;/p&gt;

&lt;p&gt;EX:&lt;br&gt;
String text = "WelcomeAjmal";&lt;br&gt;
System.out.println(text.substring(7));&lt;br&gt;
O/P = Ajmal&lt;/p&gt;

&lt;p&gt;11.&lt;strong&gt;replace()&lt;/strong&gt;- Replaces characters or words.&lt;/p&gt;

&lt;p&gt;EX:&lt;br&gt;
String text = "I like Java";&lt;br&gt;
System.out.println(text.replace("Java", "Python"));&lt;br&gt;
O/P = I like Python.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;trim()&lt;/strong&gt; - Removes spaces from beginning and end.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ex:&lt;br&gt;
String text = "  Java  ";&lt;br&gt;
System.out.println(text.trim());&lt;br&gt;
O/P = Java(remove the spaces).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;split()&lt;/strong&gt; - Splits string into array.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;EX:&lt;br&gt;
String text = "HTML,CSS,JS";&lt;br&gt;
String[] arr = text.split(",");&lt;br&gt;
System.out.println(arr[0]);&lt;br&gt;
O/P = HTML&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;indexOf()&lt;/strong&gt; - Returns index position.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;EX:&lt;br&gt;
String text = "Java";&lt;br&gt;
System.out.println(text.indexOf('v'));&lt;br&gt;
O/P = 2&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;concat()&lt;/strong&gt; - Joins strings.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;EX:&lt;br&gt;
String a = "Java";&lt;br&gt;
String b = "Program";&lt;br&gt;
System.out.println(a.concat(b));&lt;br&gt;
O/P = Java Program&lt;/p&gt;

&lt;p&gt;16.&lt;strong&gt;valueOf()&lt;/strong&gt; - Converts other data types to string.&lt;/p&gt;

&lt;p&gt;EX:&lt;br&gt;
int num = 100;&lt;br&gt;
String result = String.valueOf(num);&lt;br&gt;
System.out.println(result);&lt;br&gt;
O/P = 100&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>java</category>
      <category>programming</category>
    </item>
    <item>
      <title>String in Java.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Wed, 20 May 2026 01:04:27 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/string-in-java-5ek3</link>
      <guid>https://dev.to/mohamed_ajmal_2/string-in-java-5ek3</guid>
      <description>&lt;p&gt;String is an object that represents a sequence of characters. Unlike some other languages where strings are primitive types or arrays of characters, Java treats every string as an instance of the java.lang.String class.&lt;/p&gt;

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

&lt;p&gt;You can create strings in two primary ways:&lt;/p&gt;

&lt;p&gt;String Literal: Most common and memory-efficient.String s = "Hello";&lt;/p&gt;

&lt;p&gt;Using new Keyword: Creates a new object in heap memory even if the same string already exists in the pool.&lt;br&gt;
String s = new String("Hello");&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Concepts:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Immutability: Once created, a String object cannot be changed. It actually create a Brand new String objects.&lt;/p&gt;

&lt;p&gt;Memory Management: Java uses a special memory area called the String Constant Pool (SCP) to store string literals. If you create multiple strings with the same literal value, they all point to the same object in the pool to save memory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4zkqlvcofpziuckbz3dq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4zkqlvcofpziuckbz3dq.png" alt=" " width="318" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Essential String Methods:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Java String Class provides dozens of built-in methods for manipulation: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;length() - Returns the number of characters in the string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;charAt - (int index)Returns the character at the specified index.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;equals(String another)Compares the actual content of two strings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;substring(int start, int end)Extracts a portion of the string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;toUpperCase() / toLowerCase()Converts the string case.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;trim()Removes leading and trailing whitespace.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Mutable Alternatives:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your program needs to modify strings frequently (like in a loop), use these mutable classes to avoid creating excessive temporary objects. &lt;/p&gt;

&lt;p&gt;StringBuilder: Best for single-threaded environments because it is faster (not synchronized).&lt;/p&gt;

&lt;p&gt;StringBuffer: Used for multi-threaded environments as it is thread-safe (synchronized).&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>java</category>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>Abstraction in Java.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Wed, 13 May 2026 05:30:52 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/abstraction-in-java-3hlp</link>
      <guid>https://dev.to/mohamed_ajmal_2/abstraction-in-java-3hlp</guid>
      <description>&lt;p&gt;Abstraction in Java is a core Object-Oriented Programming (OOP) principle that focuses on hiding internal implementation details and showing only the essential functionality to the user.&lt;/p&gt;

&lt;p&gt;Why We Use Abstraction:&lt;/p&gt;

&lt;p&gt;Reduces Complexity: By hiding unnecessary technical details, abstraction makes large systems easier to understand, manage, and navigate.&lt;/p&gt;

&lt;p&gt;Enhances Security: It protects sensitive internal logic and data by only allowing users to access what is necessary through a public interface.&lt;/p&gt;

&lt;p&gt;Improves Maintainability: Changes to the internal code (the "how") do not break the rest of the application as long as the public abstract structure remains the same.&lt;/p&gt;

&lt;p&gt;Promotes Code Re-usability: It allows you to define common behaviors in one place (an abstract class) and share them across multiple sub classes.&lt;/p&gt;

&lt;p&gt;In Java, we use abstraction when we want to hide the complex implementation details of a system and only show the essential features to the user.&lt;/p&gt;

&lt;p&gt;To Improve Maintainability: Since the internal implementation is hidden, you can change the underlying code without affecting the code that uses the abstraction.&lt;/p&gt;

&lt;p&gt;How to create: Use the abstract keyword for the class and its unimplemented methods.&lt;/p&gt;

&lt;p&gt;How to use: Inherit the abstract class using the extends keyword in a subclass, which must then provide implementations for the abstract methods.&lt;/p&gt;

&lt;p&gt;Key Rules for Abstraction:-&lt;/p&gt;

&lt;p&gt;No Instantiation: You cannot create an object of an abstract class or an interface.&lt;/p&gt;

&lt;p&gt;Method Signature: If a class has at least one abstract method, the class itself must be declared abstract.&lt;/p&gt;

&lt;p&gt;Implementation Requirement: Any concrete (non-abstract) subclass extending an abstract class or implementing an interface must override and implement all inherited abstract methods.&lt;/p&gt;

&lt;p&gt;Constructors: Abstract classes can have constructors (to initialize shared fields), but interfaces cannot&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>java</category>
    </item>
    <item>
      <title>Encapsulation in Java</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Tue, 12 May 2026 05:55:46 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/encapsulation-in-java-24m3</link>
      <guid>https://dev.to/mohamed_ajmal_2/encapsulation-in-java-24m3</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6q74aei3h81v1ki2zpuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6q74aei3h81v1ki2zpuv.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Encapsulation in Java is the process of wrapping data (variables) and the code that acts on that data (methods) together as a single unit, typically a class.&lt;/p&gt;

&lt;p&gt;Encapsulation in Java is achieved using:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Private data members,&lt;/li&gt;
&lt;li&gt;Public getter and setter methods.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Benefits: &lt;/p&gt;

&lt;p&gt;Data Control: You can make a class read-only (by providing only getters) or write-only (by providing only setters).&lt;/p&gt;

&lt;p&gt;Validation: Setters allow you to add logic to validate data before it is saved (e.g., ensuring an age is not negative).&lt;/p&gt;

&lt;p&gt;Security: It protects sensitive internal states from unauthorized modification.&lt;/p&gt;

&lt;p&gt;Maintainability: You can change the internal implementation of a class without breaking the code that uses it.&lt;/p&gt;

&lt;p&gt;Example : class Programmer {&lt;/p&gt;

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

public String getName() { return name; }

public void setName(String name) {

    this.name = name;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;public class Geeks {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static void main(String[] args){

    Programmer p = new Programmer();
    p.setName("Geek");
    System.out.println("Name=&amp;gt; " + p.getName());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Output: Name=&amp;gt; Geek&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>java</category>
      <category>frontend</category>
      <category>development</category>
    </item>
    <item>
      <title>Package in Java.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Tue, 21 Apr 2026 06:17:40 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/package-in-java-271l</link>
      <guid>https://dev.to/mohamed_ajmal_2/package-in-java-271l</guid>
      <description>&lt;p&gt;Package is the Primary way to organize the related classes, Interface  and sub packages in to shared name space. That helps to improve organization, maintainability, and re-usability. &lt;/p&gt;

&lt;p&gt;Defining a package is the primary way to organize related classes, interfaces, and sub-packages into a shared namespace.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key purposes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Organization: Structures large projects into smaller, manageable, related units, similar to folders in a file directory.&lt;/p&gt;

&lt;p&gt;Prevent Naming Conflicts: Allows different parts of a program to use classes with the same name without conflict.&lt;/p&gt;

&lt;p&gt;Access Control: Manages visibility of classes, methods, or variables using modifiers like public, protected, or package-private.&lt;/p&gt;

&lt;p&gt;Re-usability &amp;amp; Distribution: Packaged code is easier to import, reuse across projects, or distribute as a library.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Packages&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Built-in Packages: Provided by the Java API (Standard Library). (TBD)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    java.lang: Core classes like String and Math; automatically      
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;imported into every program. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    java.util: Utility classes for collections, dates, and scanners.

    java.io: Support for input and output operations.


User-defined Packages: Created by developers to organize their own code.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxosdzru60toyr9ipawt5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxosdzru60toyr9ipawt5.png" alt=" " width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>java</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Constructor in Java.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Fri, 17 Apr 2026 23:07:02 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/constructor-in-java-2pla</link>
      <guid>https://dev.to/mohamed_ajmal_2/constructor-in-java-2pla</guid>
      <description>&lt;p&gt;A specialized block of code that similar to method that is automatically invoked when an instance of class is created. It's primary purpose is to initialize the state of the new object, often by assigning initial values to instance variables. It is used to set default or user-defined values for the object's attributes&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Rules&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Must match the exact name of the class,&lt;/li&gt;
&lt;li&gt;Must not have an explicit return type, not even void,&lt;/li&gt;
&lt;li&gt;Automatically called using the new keyword,&lt;/li&gt;
&lt;li&gt;Can use access modifiers (public, private, protected) but cannot be abstract, static, final, or synchronized. (TBD)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Types&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Default Constructor: Automatically provided by the Java compiler if no constructors are explicitly defined in the class. It initializes numeric fields to 0, boolean to false, and object references to null.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No-Arg Constructor: A constructor explicitly written by the programmer that accepts no parameters.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Parameterized Constructor: Takes one or more parameters to allow objects to be initialized with custom values at creation. (TBD)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy Constructor: Used to create a new object by copying the data from an existing instance of the same class. (TBD)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz80gt63h367nsvifckm9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz80gt63h367nsvifckm9.png" alt=" " width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>java</category>
    </item>
    <item>
      <title>Java variables and Objects.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Sat, 04 Apr 2026 05:57:31 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/java-variables-and-objects-c9l</link>
      <guid>https://dev.to/mohamed_ajmal_2/java-variables-and-objects-c9l</guid>
      <description>&lt;p&gt;Static variables: These are variables that are shared among all the instances of a class.&lt;/p&gt;

&lt;p&gt;Non-static variables: These are variables that belong to each individual instance of a class.&lt;/p&gt;

&lt;p&gt;Java Static Variables : When a variable is declared as static, then a single copy of the variable is created and shared among all objects at a class level. Static variables are essentially, global variables.&lt;/p&gt;

&lt;p&gt;Java Non-static variables : Non-static variables are variables that belongs to a specified object of a class, it is also known as instance variable. &lt;br&gt;
These variables are declared outside of a method, constructor or block. Each object created from the class gets its own separate copy of these variables.  &lt;/p&gt;

&lt;p&gt;Ref : &lt;a href="https://www.geeksforgeeks.org/java/difference-between-static-and-non-static-variables-in-java/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/java/difference-between-static-and-non-static-variables-in-java/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Difference between static and non-static:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7qix77455vsrs5cmj1eo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7qix77455vsrs5cmj1eo.png" alt=" " width="259" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OBJECTS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Java, an object is an instance of a class, created using the new keyword. The class acts as a blueprint, defining the object's attributes (state) and methods (behavior), while the object is the concrete entity with specific values in memory. &lt;/p&gt;

&lt;p&gt;State: Represented by attributes (variables) that store data.&lt;/p&gt;

&lt;p&gt;Behavior: Represented by methods (functions) that define the actions an object can perform.&lt;/p&gt;

&lt;p&gt;Identity: A unique name or identifier that distinguishes one object from another, even if they have the same state and behavior.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw7acg7rhzb8yzue4jbdb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw7acg7rhzb8yzue4jbdb.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>java</category>
    </item>
    <item>
      <title>OOPS Concepts in Java.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Wed, 01 Apr 2026 05:57:28 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/oops-concepts-in-java-plg</link>
      <guid>https://dev.to/mohamed_ajmal_2/oops-concepts-in-java-plg</guid>
      <description>&lt;p&gt;Object-Oriented Programming (OOPS) is a paradigm that organize the code using Classes and objects. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqcbyoa89gem9awuxe9bf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqcbyoa89gem9awuxe9bf.png" alt=" " width="261" height="193"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The seven core concepts of Object-Oriented Programming (OOPS) include the four main pillars—Encapsulation, Abstraction, Inheritance, and Polymorphism—along with Classes, Objects, and Association. These concepts allow for modular, reusable, and secure code by organizing software around data rather than functions. &lt;/p&gt;

&lt;p&gt;1.Class - Class is the Blueprint or Templates that defines data member (Attributes) and member functions (Behaviors).&lt;/p&gt;

&lt;p&gt;2.Object - An instance of a class. It is a real-world entity that holds data and has a specific state and behavior.&lt;/p&gt;

&lt;p&gt;3.Encapsulation- Wrapping data (variables) and code (methods) together as a single unit, hiding the internal state from the outside world to protect integrity.&lt;/p&gt;

&lt;p&gt;4.Abstraction- Representing essential features while hiding unnecessary background details, simplifying complex systems.&lt;/p&gt;

&lt;p&gt;5.Inheritance- The mechanism by which one class (subclass/child) acquires the properties and behaviors of another class (super class/parent), promoting code re-usability.&lt;/p&gt;

&lt;p&gt;6.Polymorphism- The ability of an entity (method or object) to take on many forms, allowing one interface to be used for a general class of actions.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>java</category>
    </item>
    <item>
      <title>Java Basic Errors.</title>
      <dc:creator>Mohamed Ajmal</dc:creator>
      <pubDate>Mon, 30 Mar 2026 05:55:20 +0000</pubDate>
      <link>https://dev.to/mohamed_ajmal_2/java-basic-errors-1nce</link>
      <guid>https://dev.to/mohamed_ajmal_2/java-basic-errors-1nce</guid>
      <description>&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;public must be start with small letter.&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Home.java:1: error: class, interface, enum, or record expected&lt;br&gt;
Public class Home {&lt;br&gt;
^&lt;br&gt;
1 error&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;File name and Class name must be same.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Home.java:1: error: class home is public, should be declared in a file named home.java&lt;br&gt;
public class home {&lt;br&gt;
       ^&lt;br&gt;
1 error&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;*&lt;em&gt;In Java, text must always be inside double quotes *&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Home.java:3: error: ')' or ',' expected&lt;br&gt;
        System.out.println(Hello, World!");&lt;br&gt;
                                       ^&lt;br&gt;
Home.java:3: error: unclosed string literal&lt;br&gt;
        System.out.println(Hello, World!");&lt;br&gt;
                                        ^&lt;br&gt;
2 errors&lt;/p&gt;

&lt;p&gt;4.**Java is case-sensitive&lt;/p&gt;

&lt;p&gt;You wrote: system ❌&lt;br&gt;
Correct is: System ✅&lt;/p&gt;

&lt;p&gt;Java thinks system is a package**&lt;/p&gt;

&lt;p&gt;Home.java:3: error: package system does not exist&lt;br&gt;
        system.out.println("Hello, World!");&lt;br&gt;
              ^&lt;br&gt;
1 error&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;**missed the method name&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Java expected an identifier (method name) after void, but it’s missing.**&lt;/p&gt;

&lt;p&gt;Home.java:2: error:  expected&lt;br&gt;
    public static void (String[] args) {&lt;br&gt;
                      ^&lt;br&gt;
1 error&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>java</category>
      <category>backend</category>
    </item>
  </channel>
</rss>
