<?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: Ajay Raja</title>
    <description>The latest articles on DEV Community by Ajay Raja (@ajayr18).</description>
    <link>https://dev.to/ajayr18</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%2F3418478%2F0d32bf9f-35ba-456c-8f68-7edca0e9b693.jpg</url>
      <title>DEV Community: Ajay Raja</title>
      <link>https://dev.to/ajayr18</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ajayr18"/>
    <language>en</language>
    <item>
      <title>Advantages of Exception Handling</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Mon, 30 Mar 2026 15:07:12 +0000</pubDate>
      <link>https://dev.to/ajayr18/advantages-of-exception-handling-3m5o</link>
      <guid>https://dev.to/ajayr18/advantages-of-exception-handling-3m5o</guid>
      <description>&lt;p&gt;&lt;strong&gt;1.Prevents Program Crash:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exception handling stops the program from terminating suddenly&lt;/li&gt;
&lt;li&gt;It catches the error and allows execution to continue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2.Maintains Normal Flow of Execution:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Even if an error occurs, the remaining code will execute&lt;/li&gt;
&lt;li&gt;Helps the program run smoothly without interruption&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3.Improves User Experience:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Displays user-friendly messages instead of technical errors&lt;/li&gt;
&lt;li&gt;Makes the application easier to use&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4.Helps in Debugging:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provides error details like type and location.&lt;/li&gt;
&lt;li&gt;Makes it easier for developers to identify and fix issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5.Separates Error Handling Code:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeps normal logic separate from error-handling logic&lt;/li&gt;
&lt;li&gt;Improves code structure and readability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6.Makes Code Maintainable:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean and organized code is easier to update and modify&lt;/li&gt;
&lt;li&gt;Reduces confusion for developers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7.Handles Multiple Errors:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Different types of exceptions can be handled separately&lt;/li&gt;
&lt;li&gt;Uses multiple catch blocks for better control&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8.Ensures Resource Management:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;finally block is used to release resources&lt;/li&gt;
&lt;li&gt;Prevents memory leaks (closing files, DB connections)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>career</category>
      <category>java</category>
    </item>
    <item>
      <title>Exception Handling</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Mon, 30 Mar 2026 07:36:37 +0000</pubDate>
      <link>https://dev.to/ajayr18/exception-handling-3hif</link>
      <guid>https://dev.to/ajayr18/exception-handling-3hif</guid>
      <description>&lt;p&gt;Exception handling allows a program to deal with errors in a controlled way, ensuring smooth execution.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Exception Handling?
&lt;/h2&gt;

&lt;p&gt;Exception handling is a technique used to handle &lt;strong&gt;runtime errors&lt;/strong&gt; so that the program continues running instead of stopping suddenly.&lt;/p&gt;

&lt;h2&gt;
  
  
  In simple terms, it helps manage unexpected problems during program execution.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Types of Errors in Programming
&lt;/h2&gt;

&lt;p&gt;Understanding errors is important before learning exception handling. There are three main types:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Compile-Time Errors
&lt;/h3&gt;

&lt;p&gt;These errors occur during compilation due to syntax mistakes.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  2. Runtime Errors (Exceptions)
&lt;/h3&gt;

&lt;p&gt;These occur while the program is running and can cause it to crash.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. Logical Errors
&lt;/h3&gt;

&lt;p&gt;These errors do not stop the program but produce incorrect output.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What is an Exception?
&lt;/h2&gt;

&lt;p&gt;An exception is an error that occurs during the execution of a program. When an exception happens, the normal flow of the program is interrupted.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ArithmeticException&lt;/li&gt;
&lt;li&gt;NullPointerException&lt;/li&gt;
&lt;li&gt;ArrayIndexOutOfBoundsException&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Keywords Used in Exception Handling
&lt;/h2&gt;

&lt;h3&gt;
  
  
  try
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;try&lt;/code&gt; block contains code that may cause an exception.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  catch
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;catch&lt;/code&gt; block handles the exception.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ArithmeticException&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Cannot divide by zero"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  finally
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;finally&lt;/code&gt; block always executes, whether an exception occurs or not.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Execution completed"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Example Program
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ArithmeticException&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Error: Cannot divide by zero"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Program ended"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Importance of Exception Handling
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Prevents program crashes&lt;/li&gt;
&lt;li&gt;Maintains smooth program flow&lt;/li&gt;
&lt;li&gt;Improves user experience&lt;/li&gt;
&lt;li&gt;Helps in debugging&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>java</category>
      <category>programming</category>
    </item>
    <item>
      <title>Java Scenario Questions(string)</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Fri, 27 Mar 2026 08:44:55 +0000</pubDate>
      <link>https://dev.to/ajayr18/java-scenario-questionsstring-1bj3</link>
      <guid>https://dev.to/ajayr18/java-scenario-questionsstring-1bj3</guid>
      <description>&lt;p&gt;1.Handling Trailing Spaces in Password:&lt;/p&gt;

&lt;p&gt;Used: trim() + equals()&lt;br&gt;
User input may contain unwanted spaces. By using trim(), spaces at the beginning and end are removed before comparing the password.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;trim&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;equals&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;correctPassword&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.Case-Insensitive Comparison:&lt;/p&gt;

&lt;p&gt;Used: equalsIgnoreCase()&lt;br&gt;
This method allows comparison of two strings without considering uppercase and lowercase differences.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;nameFromUI&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;equalsIgnoreCase&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nameFromDB&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.Difference Between == and equals():&lt;/p&gt;

&lt;p&gt;Used: equals()&lt;br&gt;
In Java, == compares memory references, while equals() compares actual string values.&lt;br&gt;
For string comparison, always use equals().&lt;/p&gt;

&lt;p&gt;4.Email Validation:&lt;/p&gt;

&lt;p&gt;Used:contains()&lt;br&gt;
To perform basic validation, check whether the email contains '@' and '.'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"@"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"."&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.String to Integer Conversion:&lt;/p&gt;

&lt;p&gt;Used:Integer.parseInt()&lt;br&gt;
This method converts a string into an integer so that arithmetic operations can be performed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;parseInt&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6.Removing Extra Spaces:&lt;/p&gt;

&lt;p&gt;Used:trim()&lt;br&gt;
Removes unnecessary spaces from the beginning and end of a string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;trim&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7.Count Occurrences of a Word (To Be Discussed):&lt;/p&gt;

&lt;p&gt;Used:indexOf()&lt;br&gt;
The method is used to find the position of a substring. By repeatedly searching and moving forward, occurrences can be counted.&lt;/p&gt;

&lt;p&gt;8.Reverse a String:&lt;/p&gt;

&lt;p&gt;Used:charAt()&lt;br&gt;
Characters are accessed from the end of the string and appended to form the reversed string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;--)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;9.Palindrome Check:&lt;/p&gt;

&lt;p&gt;Used:charAt() + equals()&lt;br&gt;
The string is reversed and compared with the original. If both are equal, it is a palindrome.&lt;/p&gt;

&lt;p&gt;10.Remove Duplicate Characters:&lt;/p&gt;

&lt;p&gt;Used:indexOf()&lt;br&gt;
Each character is checked before adding to the result. If it already exists, it is skipped.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;indexOf&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;11.Extract Substring from Log:&lt;/p&gt;

&lt;p&gt;Used:substring() + indexOf()&lt;br&gt;
The position of : is found, and the text after it is extracted.&lt;/p&gt;

&lt;p&gt;12.Split CSV Data (To Be Discussed):&lt;/p&gt;

&lt;p&gt;Used:split()&lt;br&gt;
The string is divided into parts using a comma delimiter and stored in an array.&lt;/p&gt;

&lt;p&gt;13.Replace Substring:&lt;/p&gt;

&lt;p&gt;Used:replace()&lt;br&gt;
Replaces one part of the string with another.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;replace&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Spring Boot"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;14.Mobile Number Validation:[TBD]&lt;/p&gt;

&lt;p&gt;Used:matches()&lt;br&gt;
Regex is used to ensure the number contains exactly 10 digits.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;matches&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"\\d{10}"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;15.Split String Using Delimiter:&lt;/p&gt;

&lt;p&gt;Used:split()&lt;br&gt;
Splits the string into parts using a specific delimiter like #.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
    </item>
    <item>
      <title>String_Methods</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Tue, 24 Mar 2026 18:06:13 +0000</pubDate>
      <link>https://dev.to/ajayr18/stringmethods-125g</link>
      <guid>https://dev.to/ajayr18/stringmethods-125g</guid>
      <description>&lt;h2&gt;
  
  
  In Java, the String class provides many built-in methods that help us perform operations like comparison, searching, modification, and formatting.
&lt;/h2&gt;

&lt;p&gt;1.charAt()&lt;br&gt;
This method returns the character at a specific index.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;charAt&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;2.length()&lt;/p&gt;

&lt;p&gt;Returns the total number of characters in a string.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// 4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;3.equals()&lt;/p&gt;

&lt;p&gt;Compares two strings based on their content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;equals&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;4.equalsIgnoreCase()&lt;/p&gt;

&lt;p&gt;Compares strings ignoring uppercase and lowercase differences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"JAVA"&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;equalsIgnoreCase&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"java"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;5.compareTo()&lt;/p&gt;

&lt;p&gt;Compares two strings lexicographically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"apple"&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compareTo&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"banana"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// negative&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;6.substring()&lt;/p&gt;

&lt;p&gt;Extracts part of a string.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;substring&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// av&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;7.contains()&lt;/p&gt;

&lt;p&gt;Checks if a string contains a specific value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Java Programming"&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;contains&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;8.startsWith() and endsWith()&lt;/p&gt;

&lt;p&gt;Used to check the beginning and ending of a string.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Java"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;startsWith&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Ja"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;endsWith&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"va"&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;   &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;9.toUpperCase() and toLowerCase()&lt;/p&gt;

&lt;p&gt;Used to change case of characters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"java"&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toUpperCase&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// JAVA&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"JAVA"&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toLowerCase&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// java&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;10.trim()&lt;/p&gt;

&lt;p&gt;Removes leading and trailing spaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"  Java  "&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;trim&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// Java&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;11.replace()&lt;/p&gt;

&lt;p&gt;Replaces characters or strings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"java"&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;replace&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="sc"&gt;'a'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="sc"&gt;'o'&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// jovo&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;12.split()&lt;/p&gt;

&lt;p&gt;Splits a string into parts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"a,b,c"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;split&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;","&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;]);&lt;/span&gt; &lt;span class="c1"&gt;// a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  
&lt;/h2&gt;

&lt;p&gt;13.isEmpty() and isBlank()&lt;/p&gt;

&lt;p&gt;Used to check empty strings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isEmpty&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;   &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"   "&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isBlank&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;Java String methods are essential for handling text data efficiently. Understanding these methods helps in writing better programs and solving interview problems easily. Practicing these regularly will improve coding skills and confidence.&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
    </item>
    <item>
      <title>Java_Local&amp;Global_Variable</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Tue, 10 Feb 2026 14:34:54 +0000</pubDate>
      <link>https://dev.to/ajayr18/javalocalglobalvariable-42od</link>
      <guid>https://dev.to/ajayr18/javalocalglobalvariable-42od</guid>
      <description>&lt;ul&gt;
&lt;li&gt;In Java, variables are classified based on where they are declared and where they can be accessed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Local Variable:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A local variable is declared inside a method, constructor, or block.&lt;/li&gt;
&lt;li&gt;Declared inside { } of a method or block.&lt;/li&gt;
&lt;li&gt;Accessible only inside that method/block.&lt;/li&gt;
&lt;li&gt;Must be initialized before use&lt;/li&gt;
&lt;li&gt;Lifetime exists only while method executes
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Demo {
    void show() {
        int x = 10;   // local variable
        System.out.println("Value of x: " + x);
    }
    public static void main(String[] args) {
        Demo obj = new Demo();
        obj.show();
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Global Variable (Instance Variable in Java)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In Java, there is no true global variable like in C/C++.&lt;br&gt;
Instead, we use:&lt;/p&gt;

&lt;p&gt;1)Instance Variable (Non-static)&lt;br&gt;
   2)Static Variable (Class variable)&lt;br&gt;
These are commonly called "global variables".&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1) Instance Variable:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Declared inside class but outside methods.&lt;/li&gt;
&lt;li&gt;Accessible by all methods of the class.&lt;/li&gt;
&lt;li&gt;Each object gets its own copy.&lt;/li&gt;
&lt;li&gt;Gets default value (0, null, false).
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Demo {
    int y = 20;   // instance variable
    void display() {
        System.out.println("Value of y: " + y);
    }
    public static void main(String[] args) {
        Demo obj = new Demo();
        obj.display();
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2)Static Variable(Class Variable)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Declared using static keyword.&lt;/li&gt;
&lt;li&gt;Shared among all objects.&lt;/li&gt;
&lt;li&gt;Accessed using class name.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Demo {
    static int z = 30;  // static variable
    public static void main(String[] args) {
        System.out.println("Value of z: " + Demo.z);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>java</category>
      <category>softwaredevelopment</category>
      <category>coding</category>
    </item>
    <item>
      <title>JavaScript Basic Array Methods</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Mon, 09 Feb 2026 05:11:45 +0000</pubDate>
      <link>https://dev.to/ajayr18/javascript-basic-array-methods-3l90</link>
      <guid>https://dev.to/ajayr18/javascript-basic-array-methods-3l90</guid>
      <description>&lt;p&gt;1)Array length:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The length property returns the length (size) of an array
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];
let size = fruits.length;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;-The length property can also be used to set the length of an array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.length = 2;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2)Array toString()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The toString() method returns the elements of an array as a comma separated string.&lt;/li&gt;
&lt;li&gt;Every JavaScript object has a toString() method.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];
let myList = fruits.toString();
output:
The toString() method returns the elements of an array as a comma separated string:
Banana,Orange,Apple,Mango
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3)Array at()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The at() method returns an indexed element from an array.&lt;/li&gt;
&lt;li&gt;The at() method returns the same as []
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];
let fruit = fruits.at(2);
output:
The at() method returns an indexed element from an array:
Apple
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4)Array join()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The join() method also joins all array elements into a string.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits.join(" * ");
output:
The join() method joins array elements into a string.
It this example we have used " * " as a separator between the elements:
Banana * Orange * Apple * Mango
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5)Array pop() and Array push()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The pop() method removes the last element from an array&lt;/li&gt;
&lt;li&gt;The push() method adds a new element to an array (at the end).
-The push() method returns the new array length.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;6)Array shift()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The shift() method removes the first array element and "shifts" all other elements to a lower index.&lt;/li&gt;
&lt;li&gt;The shift() method returns the value that was "shifted out".
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();
output:
The shift() method removes the first element of an array (and "shifts" the other elements to the left):

Banana,Orange,Apple,Mango

Orange,Apple,Mango
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7)Array unshift()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The unshift() method adds a new element to an array (at the beginning), and "unshifts" older elements&lt;/li&gt;
&lt;li&gt;The unshift() method returns the new array length
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.unshift("Lemon");
output:
The unshift() method adds new elements to the beginning of an array:
Banana,Orange,Apple,Mango
Lemon,Banana,Orange,Apple,Mango
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;8)Array concat()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The concat() method creates a new array by merging (concatenating) existing arrays&lt;/li&gt;
&lt;li&gt;The concat() method does not change the existing arrays. It always returns a new array.&lt;/li&gt;
&lt;li&gt;The concat() method can take any number of array arguments.&lt;/li&gt;
&lt;li&gt;The concat() method can also take strings as arguments.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myGirls = ["Cecilie", "Lone"];
const myBoys = ["Emil", "Tobias", "Linus"];

const myChildren = myGirls.concat(myBoys);
output:
The concat() method merges (concatenates) arrays:

Cecilie,Lone,Emil,Tobias,Linus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example (Merging Three Arrays)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;const arr1 = ["Cecilie", "Lone"];&lt;br&gt;
const arr2 = ["Emil", "Tobias", "Linus"];&lt;br&gt;
const arr3 = ["Robin", "Morgan"];&lt;br&gt;
const myChildren = arr1.concat(arr2, arr3);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example (Merging an Array with Values)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;const arr1 = ["Emil", "Tobias", "Linus"];&lt;br&gt;
const myChildren = arr1.concat("Peter"); &lt;/p&gt;

&lt;p&gt;9)Array copyWithin()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The copyWithin() method copies array elements to another position in an array.&lt;/li&gt;
&lt;li&gt;The copyWithin() method overwrites the existing values.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits.copyWithin(2,0);
output:
copyWithin() copies array elements to another position in an array, overwriting existing values:
Copy to index 2, all elements from index 0:
Banana,Orange,Banana,Orange
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;10)Array flat()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The flat() method creates a new array with sub-array elements concatenated to a specified depth.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myArr = [[1,2],[3,4],[5,6]];
const newArr = myArr.flat();
output:
The flat() Method
1,2,3,4,5,6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;11)Array flatMap()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The flatMap() method first maps all elements of an array and then creates a new array by flattening the array.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myArr = [1, 2, 3, 4, 5,6];
const newArr = myArr.flatMap(x =&amp;gt; [x, x * 10]);
output:
The flatMap() Method
1,10,2,20,3,30,4,40,5,50,6,60
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;12)Array slice()&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The slice() method slices out a piece of an array into a new array.&lt;/li&gt;
&lt;li&gt;The slice() method creates a new array.&lt;/li&gt;
&lt;li&gt;The slice() method does not remove any elements from the source array.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
const citrus = fruits.slice(1);
output:
Slice out a part of an array starting from array element 1 ("Orange"):
Banana,Orange,Lemon,Apple,Mango
Orange,Lemon,Apple,Mango
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>DataTypes_Java:)</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Sat, 07 Feb 2026 07:45:44 +0000</pubDate>
      <link>https://dev.to/ajayr18/datatypesjava-59b1</link>
      <guid>https://dev.to/ajayr18/datatypesjava-59b1</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%2Fv89ioaxknx3hlsksb8i6.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%2Fv89ioaxknx3hlsksb8i6.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Java, every variable must have a data type.&lt;/li&gt;
&lt;li&gt;A data type tells the compiler what kind of value a variable can store and how much memory it needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What is a Data Type?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A data type is a classification that specifies the type of value a variable can hold.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Types of Data Types in Java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1)Primitive Data Types&lt;br&gt;
2)Non-Primitive (Reference) Data Types&lt;/p&gt;

&lt;p&gt;Primitive Data Types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Primitive data types store simple values directly in memory.&lt;/li&gt;
&lt;li&gt;They are predefined by Java and are not objects.&lt;/li&gt;
&lt;li&gt;Java has 8 primitive data types.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;1)byte:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Used to store small whole numbers.&lt;/li&gt;
&lt;li&gt;Size: 1 byte (8 bits)&lt;/li&gt;
&lt;li&gt;Range: -128 to 127.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;byte age = 25;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2)short:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stores slightly larger whole numbers than byte.&lt;/li&gt;
&lt;li&gt;Size: 2 bytes&lt;/li&gt;
&lt;li&gt;Range: -32,768 to 32,767
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;short year = 2025;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3)int (Most Common Integer Type):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;used to store whole numbers.&lt;/li&gt;
&lt;li&gt;Size: 4 bytes&lt;/li&gt;
&lt;li&gt;Range: -2,147,483,648 to 2,147,483,647
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int marks = 95;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4)long:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stores very large whole numbers.&lt;/li&gt;
&lt;li&gt;Size: 8 bytes&lt;/li&gt;
&lt;li&gt;Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;long population = 8000000000L;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5)float:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stores decimal numbers with single precision.&lt;/li&gt;
&lt;li&gt;Size: 4 bytes&lt;/li&gt;
&lt;li&gt;Precision: 6–7 decimal digits
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;float temperature = 36.5f;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6)double (Most Common Decimal Type):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stores decimal numbers with double precision.&lt;/li&gt;
&lt;li&gt;Size: 8 bytes&lt;/li&gt;
&lt;li&gt;Precision: 15–16 decimal digits
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;double salary = 25000.75;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7)char:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stores a single character.&lt;/li&gt;
&lt;li&gt;Size: 2 bytes&lt;/li&gt;
&lt;li&gt;Range: 0 to 65,535 (Unicode values)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;char grade = 'A';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;8)boolean:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stores true or false values.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;boolean isPassed = true;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Non-Primitive (Reference) Data Types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;These store memory addresses instead of actual values.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;1)String:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Used to store text.&lt;/li&gt;
&lt;li&gt;Immutable (cannot be changed after creation).
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;2)Arrays:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Used to store multiple values of the same type.&lt;/li&gt;
&lt;li&gt;Fixed size once created.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int[] numbers = {1, 2, 3};
System.out.println(numbers[0]); // 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>java</category>
      <category>tutorial</category>
      <category>career</category>
    </item>
    <item>
      <title>Java_class,Object</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Sat, 07 Feb 2026 06:02:58 +0000</pubDate>
      <link>https://dev.to/ajayr18/javaclassobject-17ag</link>
      <guid>https://dev.to/ajayr18/javaclassobject-17ag</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Java is an object-oriented programming language.&lt;/li&gt;
&lt;li&gt;Everything revolves around class and object.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What is a Class in Java?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To create a class, use the keyword class.&lt;/li&gt;
&lt;li&gt;A class is a user-defined data type in Java that groups variables and methods together into a single unit.&lt;/li&gt;
&lt;li&gt;A class acts as a blueprint that describes how objects should look and behave.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Student {
    String name;
    int age;
    void study() {
        System.out.println(name + " is studying");
    }
}
Here:
name,age → variables
study() → method
Student → class
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What is an Object in Java?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Java, an object is created from a class. &lt;/li&gt;
&lt;li&gt;An object is a real-world entity created from a class that contains actual data and can use the methods defined in the class.&lt;/li&gt;
&lt;li&gt;An instance of a class means an object created from that class.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why “Instance” is Important?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It represents the class in memory.&lt;/li&gt;
&lt;li&gt;Multiple instances can be created from one class.&lt;/li&gt;
&lt;li&gt;Each instance can store different values.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Main {
    public static void main(String[] args) {
        Student s1 = new Student();
        s1.name = "Ajay";
        s1.age = 21;
        s1.study();
    }
}

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

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>java</category>
      <category>tutorial</category>
      <category>career</category>
    </item>
    <item>
      <title>Features_of_Java</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Thu, 05 Feb 2026 05:33:45 +0000</pubDate>
      <link>https://dev.to/ajayr18/featuresofjava-4fkb</link>
      <guid>https://dev.to/ajayr18/featuresofjava-4fkb</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%2Fphv2ebrmyof92t19c5ix.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%2Fphv2ebrmyof92t19c5ix.png" alt=" " width="800" height="572"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1.Simple Syntax:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java syntax is very straightforward and very easy to learn.&lt;/li&gt;
&lt;li&gt;It inherits many features from C, C++.&lt;/li&gt;
&lt;li&gt;It provides automatic garbage collection. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.Object Oriented :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java can be easily extended since it is based on the Object model. &lt;/li&gt;
&lt;li&gt;This approach promotes modularity, reusability, and a clear structure in code organization.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3.Platform Independent :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java is designed in Write Once, Run Anywhere (WORA) way. &lt;/li&gt;
&lt;li&gt;When we write Java code, it is first compiled by the compiler and then converted into bytecode (which is platform-independent). &lt;/li&gt;
&lt;li&gt;This byte code can run on any platform which has JVM installed. &lt;/li&gt;
&lt;li&gt;It makes java code highly portable and useful for application running on multiple platforms.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;4.Scalable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java can handle both small and large-scale applications. J&lt;/li&gt;
&lt;li&gt;Java provides features like multithreading and distributed computing that allows developers to manage loads more easily.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;5.Portable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java programs can execute in any environment which there is a Java run-time system.(JVM)&lt;/li&gt;
&lt;li&gt;Java programs can be run on any platform(Linux,Window,Mac)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;6.Secured and Robust:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Catching runtime errors early keeps the program running reliably.&lt;/li&gt;
&lt;li&gt;Built-in libraries for encryption, digital signatures, and secure communication.&lt;/li&gt;
&lt;li&gt;Checks code for illegal operations before execution to ensure safety.&lt;/li&gt;
&lt;li&gt;Automatically manages memory to prevent leaks and crashes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;7.Memory Management:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Memory management in Java is automatically handled by the Java Virtual Machine (JVM). &lt;/li&gt;
&lt;li&gt;Java automatically removes "trash" (unused data) so you don't have to delete it manually.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;8.High Performance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java is faster than old interpreted languages.&lt;/li&gt;
&lt;li&gt;It is slower than fully compiled languages like C or C++ because of interpretation and JIT compilation process.&lt;/li&gt;
&lt;li&gt;Java performance is improve with the help of Just-In-Time (JIT) compilation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;9.Documentation and Community Support:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java provide documentation which includes guides, API references, and tutorials for easy learning.&lt;/li&gt;
&lt;li&gt;Java has a large and active global community contributing to open-source projects, and resources.&lt;/li&gt;
&lt;li&gt;This community support helps developers solve problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;10.Rich Standard Library:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java provides various pre-built tools and libraries which is known as Java API.&lt;/li&gt;
&lt;li&gt;Java API is used to cover tasks like file handling, networking, database connectivity (JDBC), security, etc. &lt;/li&gt;
&lt;li&gt; With the help of these libraries developers save a lot of time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;11.Support for Mobile and Web Application:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java offers support for both web and mobile applications.&lt;/li&gt;
&lt;li&gt;Java offers technologies like JSP and Servlets, along with frameworks like Spring and Springboot, which makes it easier to build web applications.&lt;/li&gt;
&lt;li&gt;Java is the main language for Android app development. &lt;/li&gt;
&lt;li&gt;The Android SDK uses special version of Java.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>java</category>
    </item>
    <item>
      <title>Java_Architecture</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Tue, 03 Feb 2026 19:04:10 +0000</pubDate>
      <link>https://dev.to/ajayr18/javaarchitecture-2ml</link>
      <guid>https://dev.to/ajayr18/javaarchitecture-2ml</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%2Fk7584fvixfz60y7qfcyx.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%2Fk7584fvixfz60y7qfcyx.png" alt=" " width="720" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Java Development Kit (JDK)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.It is used to build and develop the java program.&lt;br&gt;
2.It internally contains JRE.&lt;br&gt;
3.It contains the compiler and debugger.&lt;br&gt;
4.It understands bytecode (.class file).&lt;br&gt;
5.Without JDK we can’t build any java program.&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%2F1fqntjg4z7m4jst5xci8.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%2F1fqntjg4z7m4jst5xci8.png" alt=" " width="650" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Working Process of JDK:&lt;/strong&gt;&lt;br&gt;
Compilation:&lt;br&gt;
1.The developer writes Java code in a .java file&lt;br&gt;
2.The JDK provides the Java compiler (javac).&lt;br&gt;
3.The compiler converts the source code into bytecode (.class file).&lt;br&gt;
4.This bytecode is then passed to the JRE to execute.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Java Runtime Environment (JRE)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.JRE is the responsible unit to run the java program.&lt;br&gt;
2.Without JRE we can’t run java program.&lt;br&gt;
3.I mean with only JRE we can run the java program without JDK.&lt;br&gt;
4.It is only used to execute Java programs.&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%2Fxj8csqzvimbbfnwh9xui.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%2Fxj8csqzvimbbfnwh9xui.png" alt=" " width="562" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Working Process of JRE&lt;/strong&gt;&lt;br&gt;
1.JRE receives the compiled bytecode (.class file).&lt;br&gt;
2.It loads the required system libraries and runtime files.&lt;br&gt;
3.It uses the JVM to execute the bytecode.&lt;br&gt;
4.JRE provides the environment and uses JVM to run Java programs smoothly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JVM (Java Virtual Machine)&lt;/strong&gt;&lt;br&gt;
1.JVM is a virtual machine that executes Java bytecode.&lt;br&gt;
2.The JVM converts this bytecode into machine code that your system understands.&lt;br&gt;
3.JVM is the main reason why Java is platform-independent.&lt;br&gt;
4.Different operating systems have different JVMs, but the same bytecode can run on all of them.&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%2Fx9r96pifkd3pj0esgmqs.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%2Fx9r96pifkd3pj0esgmqs.png" alt=" " width="520" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Working Process of JVM&lt;/strong&gt;&lt;br&gt;
1.Class Loading---&amp;gt;JVM loads the compiled (.class) file into memory.&lt;br&gt;
2.Bytecode Verification---&amp;gt;It checks the bytecode for security and correctness.&lt;br&gt;
3.Execution----&amp;gt;The Execution Engine converts bytecode into machine code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JIT (Just-In-Time Compiler)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.JIT is a part of the JVM.&lt;br&gt;
2.It improves the performance of Java programs.&lt;br&gt;
3.It converts bytecode into machine code at runtime.&lt;br&gt;
4.It makes Java applications run faster.&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%2Fxbko4rbqmyi6f8m7gu2c.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%2Fxbko4rbqmyi6f8m7gu2c.png" alt=" " width="464" height="664"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
    </item>
    <item>
      <title>HTML&amp;CSS</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Wed, 24 Sep 2025 17:57:06 +0000</pubDate>
      <link>https://dev.to/ajayr18/htmlcss-p9m</link>
      <guid>https://dev.to/ajayr18/htmlcss-p9m</guid>
      <description>&lt;p&gt;1.HTML:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML (HyperText Markup Language) is the most basic building block of the Web.&lt;/li&gt;
&lt;li&gt;It defines the meaning and structure of web content. &lt;/li&gt;
&lt;li&gt;"Hypertext" refers to links that connect web pages to one another, either within a single website or between websites. &lt;/li&gt;
&lt;li&gt;HTML uses "markup" to annotate text, images, and other content for display in a Web browser. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ref:&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/HTML&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.CSS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CSS is the language we use to style a Web page.&lt;/li&gt;
&lt;li&gt;CSS stands for Cascading Style Sheets&lt;/li&gt;
&lt;li&gt;CSS can be used for many purposes related to the look and feel of your web page.&lt;/li&gt;
&lt;li&gt;Text styling, including changing the color and size of headings.&lt;/li&gt;
&lt;li&gt;Creating layouts, such as grid layouts or multiple-column layouts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ref:&lt;a href="https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Styling_basics/What_is_CSS" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Styling_basics/What_is_CSS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.Display flex:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In flex box means  you need to remember one thing one is main axis and another one is cross axis&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Main axis
&lt;/h1&gt;

&lt;p&gt;The main axis is defined by flex-direction, which has four possible values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    row
    row-reverse
    column
    column-reverse

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Should you choose row or row-reverse, your main axis will run along the row in the inline direction.&lt;/li&gt;
&lt;/ul&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%2Fkzxp7lrobhtvmx51aa1b.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%2Fkzxp7lrobhtvmx51aa1b.png" alt=" " width="800" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose column or column-reverse and your main axis will run in the block direction, from the top of the page to the bottom.&lt;/li&gt;
&lt;/ul&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%2Fe0cb6zzkeevxwdt0uy95.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%2Fe0cb6zzkeevxwdt0uy95.png" alt=" " width="800" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Cross axis:
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;The cross axis runs perpendicular to the main axis. &lt;/li&gt;
&lt;li&gt;if your flex-direction (main axis) is set to row or row-reverse the cross axis runs down the columns.&lt;/li&gt;
&lt;/ul&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%2Fjg29yl8zpqosutk32i4c.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%2Fjg29yl8zpqosutk32i4c.png" alt=" " width="800" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If your main axis is column or column-reverse then the cross axis runs along the rows.&lt;/li&gt;
&lt;/ul&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%2Fcrs9yh1ynglheg998kpd.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%2Fcrs9yh1ynglheg998kpd.png" alt=" " width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TO BE CONTINUED&lt;br&gt;
....&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Constructor_Keywords</title>
      <dc:creator>Ajay Raja</dc:creator>
      <pubDate>Wed, 10 Sep 2025 17:03:37 +0000</pubDate>
      <link>https://dev.to/ajayr18/constructorkeywords-3efg</link>
      <guid>https://dev.to/ajayr18/constructorkeywords-3efg</guid>
      <description>&lt;h2&gt;
  
  
  This Keyword
&lt;/h2&gt;

&lt;p&gt;What is this?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;this is a Keyword in Java that refers to the current object of the class.&lt;/li&gt;
&lt;li&gt;It is a fundamental concept in object-oriented programming.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When we use this?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When local variables and instance variables have the same name.&lt;/li&gt;
&lt;li&gt;can be used within a constructor to call another constructor of the same class.&lt;/li&gt;
&lt;li&gt;When you want to pass the current object to another method or constructor.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How it will be used?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;this.variable --- access current object variable.&lt;/li&gt;
&lt;li&gt;this.method() --- call a method of the same class.&lt;/li&gt;
&lt;li&gt;this() → call another constructor of the same class.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Where we use?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In constructors ---- to call another constructor.&lt;/li&gt;
&lt;li&gt;In instance methods ---- to access variables/methods of the same object.&lt;/li&gt;
&lt;li&gt;When passing the current object ---- as a parameter.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why we use?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To reuse constructors instead of duplicating code.&lt;/li&gt;
&lt;li&gt;To remove confusion between local and instance variables.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  super keyword
&lt;/h2&gt;

&lt;p&gt;What is super?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;super is a keyword that refers to the parent class object.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When we use super?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you want to call the parent class constructor.&lt;/li&gt;
&lt;li&gt;When a child class overrides a method but you still need the parents one.&lt;/li&gt;
&lt;li&gt;When parent and child class variables have the same name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How it will be used?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;super.variable ---- access parent class variable.&lt;/li&gt;
&lt;li&gt;super.method() ---- call parent class method.&lt;/li&gt;
&lt;li&gt;super() ---- call parent class constructor (must be first statement).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Where we use?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;inside the child class only.&lt;/li&gt;
&lt;li&gt;super() can only be in constructors.&lt;/li&gt;
&lt;li&gt;super.variable/method can be inside child methods.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why we use?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To avoid code duplication in constructors.&lt;/li&gt;
&lt;li&gt;To access hidden parent members that are overridden in child.&lt;/li&gt;
&lt;li&gt;To achieve reusability of parent class features.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>java</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
