<?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: Rajan S</title>
    <description>The latest articles on DEV Community by Rajan S (@rajan_s_494d2a0d7bb0860ef).</description>
    <link>https://dev.to/rajan_s_494d2a0d7bb0860ef</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%2F3418510%2F982e8ca4-e488-4827-ab9e-b4058a8cd520.png</url>
      <title>DEV Community: Rajan S</title>
      <link>https://dev.to/rajan_s_494d2a0d7bb0860ef</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rajan_s_494d2a0d7bb0860ef"/>
    <language>en</language>
    <item>
      <title>this and super(keyword in java)</title>
      <dc:creator>Rajan S</dc:creator>
      <pubDate>Thu, 11 Sep 2025 15:03:51 +0000</pubDate>
      <link>https://dev.to/rajan_s_494d2a0d7bb0860ef/this-and-superkeyword-in-java-oe1</link>
      <guid>https://dev.to/rajan_s_494d2a0d7bb0860ef/this-and-superkeyword-in-java-oe1</guid>
      <description>&lt;p&gt;&lt;strong&gt;this keyword&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;this is a refers to the current object of a class.&lt;/p&gt;

&lt;p&gt;2.Why use this?&lt;/p&gt;

&lt;p&gt;To avoid confusion between instance variables and parameters.&lt;/p&gt;

&lt;p&gt;To call other constructors in the same class.&lt;/p&gt;

&lt;p&gt;To pass the current object as an argument.&lt;/p&gt;

&lt;p&gt;To return the current object.&lt;/p&gt;

&lt;p&gt;To access current class members (fields, methods) inside the class.&lt;/p&gt;

&lt;p&gt;3.When to use this?&lt;/p&gt;

&lt;p&gt;When method or constructor parameters shadow instance variables.&lt;/p&gt;

&lt;p&gt;When chaining constructors using this().&lt;/p&gt;

&lt;p&gt;When returning the current object from a method.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Where is this used?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Inside non-static methods and constructors of a class.&lt;/p&gt;

&lt;p&gt;Cannot be used in static context (like static methods) because this refers to an object, and static context belongs to class.&lt;/p&gt;

&lt;p&gt;5.How to use this?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Student {
    int id;
    String name;

    Student(int id, String name) {
        this.id = id;        // 'this' differentiates between field and parameter
        this.name = name;
    }

    void display() {
        System.out.println(this.id + " " + this.name);  // refers to current object
    }

    Student getStudent() {
        return this;  // returns current object
    }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;super Keyword&lt;/strong&gt;&lt;br&gt;
 1.What is super?&lt;/p&gt;

&lt;p&gt;super is a reference variable used to refer to immediate parent class object.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why use super?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To access parent class:&lt;/p&gt;

&lt;p&gt;Constructors&lt;/p&gt;

&lt;p&gt;Methods&lt;/p&gt;

&lt;p&gt;Fields&lt;/p&gt;

&lt;p&gt;To avoid method or variable shadowing.&lt;/p&gt;

&lt;p&gt;To call overridden methods from parent class.&lt;/p&gt;

&lt;p&gt;3.When to use super?&lt;/p&gt;

&lt;p&gt;When subclass overrides a parent method but still wants to call the original version.&lt;/p&gt;

&lt;p&gt;When you want to access a parent variable that’s hidden by a child variable.&lt;/p&gt;

&lt;p&gt;When subclass constructor must call parent class constructor explicitly.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Where is super used?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Inside subclass constructors and methods.&lt;/p&gt;

&lt;p&gt;Can’t be used in static context.&lt;/p&gt;

&lt;p&gt;Must be the first statement in a constructor if used to call a parent constructor.&lt;/p&gt;

&lt;p&gt;5.How to use super?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Animal {
    String color = "Brown";

    void sound() {
        System.out.println("Animal sound");
    }
}

class Dog extends Animal {
    String color = "Black";

    void printColor() {
        System.out.println(super.color);  // access parent class variable
    }

    void sound() {
        super.sound();  // call parent class method
        System.out.println("Dog barks");
    }
}

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Java Constructors</title>
      <dc:creator>Rajan S</dc:creator>
      <pubDate>Wed, 03 Sep 2025 17:34:23 +0000</pubDate>
      <link>https://dev.to/rajan_s_494d2a0d7bb0860ef/java-constructors-4110</link>
      <guid>https://dev.to/rajan_s_494d2a0d7bb0860ef/java-constructors-4110</guid>
      <description>&lt;p&gt;&lt;strong&gt;what is constructor in java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Java, a constructor is a special type of method used to initialize objects when they are created.&lt;br&gt;
 It is called automatically when an instance of a class is created using the new keyword.&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%2Focwb7wd494pu3rumw2ge.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%2Focwb7wd494pu3rumw2ge.png" alt=" " width="625" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic program  of constructor in java:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; class Bike{

 String make;
 String model;
 int   year ;
 String color;
 int  gear  ;

 Bike(String make,String model,int year,String color,int gear)
{

 this.make=make;
 this.model=model;
 this.year=year;
 this.color=color;
 this.gear=gear;
}

void GetBike(){

System.out.println("make:"+make);
System.out.println("model:"+model);

}

void GetStructure(){
System.out.println("year:"+year);

}

void GetDep(){

System.out.println("color:"+color);
System.out.println("gear:"+gear);

}

public static void main(String[]args){

  Bike b1=new Bike("cramy","royal enfield",2020,"red",5);

  b1.GetBike();
  b1.GetStructure();
  b1.GetDep();
 }
}

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

&lt;/div&gt;



&lt;p&gt;Output:&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%2Fp6mql7h08u08m0nklmp1.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%2Fp6mql7h08u08m0nklmp1.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Polymorphism and its types</title>
      <dc:creator>Rajan S</dc:creator>
      <pubDate>Tue, 02 Sep 2025 16:11:46 +0000</pubDate>
      <link>https://dev.to/rajan_s_494d2a0d7bb0860ef/polymorphism-and-its-types-3j8d</link>
      <guid>https://dev.to/rajan_s_494d2a0d7bb0860ef/polymorphism-and-its-types-3j8d</guid>
      <description>&lt;p&gt;*&lt;em&gt;what is polymorphism in java *&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Polymorphism in Java is a core concept of Object-Oriented Programming (OOP) that allows objects to take on "many forms,"derived from the Greek words "poly" (many) and "morph" (forms).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Key features of polymorphism:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Multiple Behaviors: The same method can behave differently depending on the object that calls this method.&lt;/li&gt;
&lt;li&gt;    Method Overriding: A child class can redefine a method of its parent class.&lt;/li&gt;
&lt;li&gt;    Method Overloading: We can define multiple methods with the same name but different parameters.&lt;/li&gt;
&lt;li&gt;    Runtime Decision: At runtime, Java determines which method to call depending on the object's actual class.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Types of Polymorphism in Java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Java Polymorphism is mainly divided into two types: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Compile-Time Polymorphism (Static)&lt;/li&gt;
&lt;li&gt;    Runtime Polymorphism (Dynamic) &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%2F7uau3ws528dq751og147.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%2F7uau3ws528dq751og147.png" alt=" " width="797" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compile-time Polymorphism (Static Polymorphism):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;    This type of polymorphism is resolved during the compilation phase.&lt;/li&gt;
&lt;li&gt;    It is achieved primarily through Method Overloading.&lt;/li&gt;
&lt;li&gt;    &lt;strong&gt;Method Overloading&lt;/strong&gt;: involves defining multiple methods within the same class that share the same name but have different parameters (different number of parameters, different types of parameters, or a combination of both). The compiler determines which overloaded method to invoke based on the arguments provided during the method call.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class MathOperations {
// Method to add two integers
int add(int a, int b) {
return a + b;
}
// Method to add three integers
int add(int a, int b, int c) {
return a + b + c;
}
// Method to add two double values
double add(double a, double b) {
return a + b;
}
}
public class CompileTimePolymorphismExample {
public static void main(String[] args) {
MathOperations math = new MathOperations();
System.out.println("Sum of two integers: " + math.add(5, 10));
System.out.println("Sum of three integers: " + math.add(5, 10, 15));
System.out.println("Sum of two doubles: " + math.add(5.5, 10.5));
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Runtime Polymorphism (Dynamic Polymorphism):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This type of polymorphism is resolved during the execution (runtime) of the program.&lt;/li&gt;
&lt;li&gt;    It is achieved primarily through Method Overriding.&lt;/li&gt;
&lt;li&gt;    &lt;strong&gt;Method Overriding&lt;/strong&gt;: occurs when a subclass provides a specific implementation for a method that is already defined in its superclass. When an overridden method is called through a reference variable of the superclass, the actual method invoked is determined at runtime based on the actual object type being referred to by the reference variable (Dynamic Method Dispatch). This often involves Upcasting, where a subclass object is referred to by a superclass reference.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Animal {
void sound() {
System.out.println("Animal makes a sound");
}
}
class Dog extends Animal {
void sound() {
System.out.println("Dog barks");
}
}
class Cat extends Animal {
void sound() {
System.out.println("Cat meows");
}
}
public class RuntimePolymorphismExample {
public static void main(String[] args) {
Animal myAnimal;
myAnimal = new Dog();
myAnimal.sound(); // Outputs: Dog barks
myAnimal = new Cat();
myAnimal.sound(); // Outputs: Cat meows
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Inheritance of java &amp;types</title>
      <dc:creator>Rajan S</dc:creator>
      <pubDate>Fri, 29 Aug 2025 10:44:17 +0000</pubDate>
      <link>https://dev.to/rajan_s_494d2a0d7bb0860ef/inheritance-of-java-types-4jlg</link>
      <guid>https://dev.to/rajan_s_494d2a0d7bb0860ef/inheritance-of-java-types-4jlg</guid>
      <description>&lt;p&gt;Java Inheritance is a fundamental concept in OOP(Object-Oriented Programming). It is the mechanism in Java by which one class is allowed to inherit the features(fields and methods) of another class. In Java, Inheritance means creating new classes based on existing ones. A class that inherits from another class can reuse the methods and fields of that class&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%2Ffvckcziy6gu1beushsyn.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%2Ffvckcziy6gu1beushsyn.png" alt=" " width="501" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;types of inheritance&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Single Inheritance
Multilevel Inheritance
Hierarchical Inheritance
Multiple Inheritance
Hybrid Inheritance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Single Inheritance&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%2Fodhtg7379byzohggofyx.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%2Fodhtg7379byzohggofyx.png" alt=" " width="682" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;class vehicle{&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void bike()
{
    System.out.println("bike comfort for two person");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;p&gt;class car extends vehicle {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void red()
{
    System.out.println("car comfort for four person");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;p&gt;public class Single {&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;car c1 = new car ();

c1.bike();
c1.red();

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

&lt;/div&gt;

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

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

&lt;p&gt;bike comfort for two person&lt;br&gt;
 car comfort for four person&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Multilevel Inheritance&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%2Fiyyqlpeqs5shvhmk1tia.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%2Fiyyqlpeqs5shvhmk1tia.png" alt=" " width="688" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;class vehicle{&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void bike()
{
    System.out.println("bike comfort for two person");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;p&gt;class car extends vehicle {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void red()
{
    System.out.println("car comfort for four person");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;p&gt;class bicycle extends car {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void black ()
{
    System.out.println("i like so much");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;p&gt;public class Multilevel {&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[]) {

bicycle b1 = new bicycle();

b1.bike();
b1.red();
b1.black();

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

&lt;/div&gt;

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

&lt;p&gt;&lt;strong&gt;output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;bike comfort for two person&lt;br&gt;
 car comfort for four person&lt;br&gt;
 i like so much &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hierarchical Inheritance&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%2F5emy0wx5a6xkme30mi9x.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%2F5emy0wx5a6xkme30mi9x.png" alt=" " width="688" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;class vehicle{&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void bike()
{
    System.out.println("bike comfort for two person");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;p&gt;class car extends vehicle {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void red()
{
    System.out.println("car comfort for four person");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;p&gt;class van extends car {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void white ()
{
    System.out.println("van comfort in more person");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;p&gt;public class Hierarchical {&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[]) {

van v1 = new van();

v1.bike();
v1.red();
v1.white();

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

&lt;/div&gt;

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

&lt;p&gt;&lt;strong&gt;output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;bike comfort for two person&lt;br&gt;
car comfort for four person&lt;br&gt;
van comfort in more person&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Operator in Java</title>
      <dc:creator>Rajan S</dc:creator>
      <pubDate>Thu, 28 Aug 2025 16:22:57 +0000</pubDate>
      <link>https://dev.to/rajan_s_494d2a0d7bb0860ef/operator-in-java-5dmn</link>
      <guid>https://dev.to/rajan_s_494d2a0d7bb0860ef/operator-in-java-5dmn</guid>
      <description>&lt;p&gt;&lt;strong&gt;operator&lt;/strong&gt;&lt;br&gt;
  In Java, operators are special symbols that perform specific operations on one or more operands (variables or values). They are fundamental to writing code that performs calculations, comparisons, and logical evaluations&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Types of Operator *&lt;/em&gt;&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%2Fjac5vq5ixiq3jw4hbzov.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%2Fjac5vq5ixiq3jw4hbzov.png" alt=" " width="523" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Arithmetic Operator&lt;/li&gt;
&lt;li&gt;Assignment Operator&lt;/li&gt;
&lt;li&gt;Relational Operator&lt;/li&gt;
&lt;li&gt;Logical Operator&lt;/li&gt;
&lt;li&gt;Bitwise Operator&lt;/li&gt;
&lt;li&gt;Ternary Operator&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Arithmetic Operators in Java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, etc. The following table shows the Types of Arithmetic Operators in Java:&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%2Fhvycxtnictm80q9dcp9l.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%2Fhvycxtnictm80q9dcp9l.png" alt=" " width="600" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Assignment Operators in Java&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Java assignment operator is used to assign the value on its right to the operand on its left. The following table shows the Types of Assignment Operators in Java.&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%2Fx8ambkry54rm2kxrc543.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%2Fx8ambkry54rm2kxrc543.png" alt=" " width="557" height="416"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Relational Operators in Java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Relational Operators in Java are also known as Comparison Operators. It determines the relationship between two operands and returns the Boolean results, i.e. true or false after the comparison. The following table shows the Types of Relational Operators in Java.&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%2Fbj4bbqxu092yz8xd9vfo.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%2Fbj4bbqxu092yz8xd9vfo.png" alt=" " width="600" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logical Operators in Java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Logical Operators in Java are mainly used in conditional statements and loops for evaluating a condition. They are basically used with binary numbers. The following table shows the types of Logical Operators in Java.&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%2Fjcahbun252ixxxyqw5ra.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%2Fjcahbun252ixxxyqw5ra.png" alt=" " width="600" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bitwise Operators in Java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Bitwise Operators in Java perform bit-by-bit processing. They can be used with any of the integer types. The following table shows the Types of Bitwise Operators in Java.&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%2Fvwlm0h7ixbhzdgbl6km6.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%2Fvwlm0h7ixbhzdgbl6km6.png" alt=" " width="607" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ternary Operator in Java:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ternary Operator in Java is also known as the Conditional Operator. It is the shorthand of the if-else statement. It is the one-liner replacement of the if-else statement in Java. It is called ternary because it has three operands. The general format of the ternary operator is: Condition ? if true : if false&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%2Fx9z2m2dc9mn9dk065b7w.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%2Fx9z2m2dc9mn9dk065b7w.png" alt=" " width="676" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Parameter Method in Java</title>
      <dc:creator>Rajan S</dc:creator>
      <pubDate>Wed, 27 Aug 2025 11:19:38 +0000</pubDate>
      <link>https://dev.to/rajan_s_494d2a0d7bb0860ef/parameter-method-in-java-466a</link>
      <guid>https://dev.to/rajan_s_494d2a0d7bb0860ef/parameter-method-in-java-466a</guid>
      <description>&lt;p&gt;&lt;strong&gt;Java Method Parameters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Parameters are variables defined in the method declaration after the method name, inside the parentheses. This includes primitive types such as int, float, boolean, etc, and non-primitive or object types such as an array, String, etc.&lt;/p&gt;

&lt;p&gt;Today  day class is parameters method topic taken in the class .&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is a Parameter in a Method&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A parameter is a variable in the method definition that accepts a value (called an argument) when the method is called.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Parameters&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Formal Parameters&lt;/strong&gt;&lt;br&gt;
Defined in the method declaration.&lt;br&gt;
Example: int a, int b in add(int a, int b)&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Actual Parameters *&lt;/em&gt;(Arguments)&lt;br&gt;
Passed when calling the method.&lt;br&gt;
Example: add(5, 3) – here 5 and 3 are actual parameters.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.geeksforgeeks.org/java/java-method-parameters/" rel="noopener noreferrer"&gt;https://www.geeksforgeeks.org/java/java-method-parameters/&lt;/a&gt;&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%2Fyw69iobh1soubltu3rxh.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%2Fyw69iobh1soubltu3rxh.png" alt=" " width="800" height="450"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Today complete my task&lt;/strong&gt;&lt;br&gt;
class Hello {&lt;/p&gt;

&lt;p&gt;int num1;&lt;br&gt;
  int num2;&lt;br&gt;
  int num3;&lt;/p&gt;

&lt;p&gt;Hello(int x,int y, int z) {&lt;br&gt;
        num1 = x;&lt;br&gt;
        num2 = y;&lt;br&gt;
        num3 = z;&lt;/p&gt;

&lt;p&gt;}&lt;br&gt;
   int addTwo(){&lt;br&gt;
   return num1 + num2;&lt;br&gt;
}&lt;br&gt;
   int addThree(){&lt;br&gt;
   return num1 + num2 + num3;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;int subTwo(){&lt;br&gt;
   return num1 - num2;&lt;br&gt;
} &lt;br&gt;
   int subThree(){&lt;br&gt;
   return num1 - num2 - num3;&lt;br&gt;
}&lt;br&gt;
   int multiplicationTwo(){&lt;br&gt;
   return num1 * num2;&lt;br&gt;
}&lt;br&gt;
   int multiplicationThree(){&lt;br&gt;
   return num1 * num2 * num3;&lt;br&gt;
}&lt;br&gt;
   int diviTwo(){&lt;br&gt;
   return num1 / num2;&lt;br&gt;
}&lt;br&gt;
   int diviThree(){&lt;br&gt;
   return num1 / num2 / num3;&lt;br&gt;
}&lt;br&gt;
   int modulusTwo(){&lt;br&gt;
   return num1 % num2;&lt;br&gt;
}&lt;br&gt;
   int modulusThree(){&lt;br&gt;
   return num1 % num2 % num3;&lt;br&gt;
}&lt;br&gt;
 void displayDetails(){&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    System.out.println("Numbers: " + num1 + " , " + num2 + " , " + num3);

    System.out.println("Add num1 + num2 = " + addTwo());

    System.out.println("Add num1 + num2 + num3 = " + addThree());

    System.out.println("Sub num1 - num2 = " + subTwo());

    System.out.println("Sub num1 - num2 - num3 = " + subThree());

    System.out.println("Multiplication num1 * num2 = " + multiplicationTwo());

    System.out.println("Multiplication num1 * num2 * num3 = " + multiplicationThree());

    System.out.println("Divi num1 / num2 = " + diviTwo());

    System.out.println("Divi num1 / num2 / num3 = " + diviThree());

    System.out.println("Modulus num1 % num2 = " + modulusTwo());

    System.out.println("Modulus num1 % num2 % num3 = " + modulusThree());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

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

&lt;p&gt;Hello h1 = new Hello(414,524,656);&lt;br&gt;
  h1.displayDetails();&lt;br&gt;
  }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;output&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Numbers: 414 , 524 , 656&lt;br&gt;
Add num1 + num2 = 938&lt;br&gt;
Add num1 + num2 + num3 = 1594&lt;br&gt;
Sub num1 - num2 = -110&lt;br&gt;
Sub num1 - num2 - num3 = -766&lt;br&gt;
Multiplication num1 * num2 = 216936&lt;br&gt;
Multiplication num1 * num2 * num3 = 142310016&lt;br&gt;
Divi num1 / num2 = 0&lt;br&gt;
Divi num1 / num2 / num3 = 0&lt;br&gt;
Modulus num1 % num2 = 414&lt;br&gt;
Modulus num1 % num2 % num3 = 414&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Type casting</title>
      <dc:creator>Rajan S</dc:creator>
      <pubDate>Tue, 26 Aug 2025 14:08:41 +0000</pubDate>
      <link>https://dev.to/rajan_s_494d2a0d7bb0860ef/type-casting-2nli</link>
      <guid>https://dev.to/rajan_s_494d2a0d7bb0860ef/type-casting-2nli</guid>
      <description>&lt;p&gt;&lt;strong&gt;Java Type Casting&lt;/strong&gt;&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%2Fqj0vagzzvn1ctoystmz2.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%2Fqj0vagzzvn1ctoystmz2.png" alt=" " width="300" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;java type casting *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Type casting in Java is the process of converting one data type into another. It is essential when you want to perform operations between different data types or when you need to store a value of one type into a variable of another type. Java supports two types of casting: implicit (automatic) casting and explicit (manual) casting.&lt;/p&gt;

&lt;p&gt;Type casting is when you assign a value of one primitive data type to another type.&lt;/p&gt;

&lt;p&gt;In Java, there are two types of casting:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Widening Casting&lt;/strong&gt;(implicit)
(automatically) - converting a smaller type to a larger type size
byte -&amp;gt; short -&amp;gt; char -&amp;gt; int -&amp;gt; long -&amp;gt; float -&amp;gt; double&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here’s an example to illustrate widening type casting in Java&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Narrowing Casting&lt;/strong&gt;(explicit) &lt;br&gt;
(manually) - converting a larger type to a smaller size type&lt;br&gt;
double -&amp;gt; float -&amp;gt; long -&amp;gt; int -&amp;gt; char -&amp;gt; short -&amp;gt; byte &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Widening or Automatic type converion&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;Automatic Type casting take place when,&lt;/p&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;the two types are compatible&lt;/li&gt;
&lt;li&gt;the target type is larger than the source type&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example:&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%2Fnjgsexh0ui0bja5ydqy9.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%2Fnjgsexh0ui0bja5ydqy9.png" alt=" " width="800" height="385"&gt;&lt;/a&gt;&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%2F0u1sh649vuf4n1um4oe1.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%2F0u1sh649vuf4n1um4oe1.png" alt=" " width="800" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;Narrowing or Explicit type conversion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you are assigning a larger type value to a variable of smaller type, then you need to perform explicit type casting. If we don't perform casting then compiler reports compile time error.&lt;/p&gt;

&lt;p&gt;Example :&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%2Fy1oi5zzl1558ujvu7khn.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%2Fy1oi5zzl1558ujvu7khn.png" alt=" " width="800" height="412"&gt;&lt;/a&gt;&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%2Ffr8iptc8iwkiyg3m3dc4.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%2Ffr8iptc8iwkiyg3m3dc4.png" alt=" " width="800" height="133"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example of Explicit Conversion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here, we have one more example of explicit casting, double type is stored into long, long is stored into int etc.&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%2F74tkflhnbp44a8klqigb.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%2F74tkflhnbp44a8klqigb.png" alt=" " width="800" height="412"&gt;&lt;/a&gt;&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%2Flis19s7d3qqtamtrrbt6.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%2Flis19s7d3qqtamtrrbt6.png" alt=" " width="627" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

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