<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Arun Menon on Medium]]></title>
        <description><![CDATA[Stories by Arun Menon on Medium]]></description>
        <link>https://medium.com/@menonarun23?source=rss-120ac21c59fb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AeQFML_D2jK0T39e</url>
            <title>Stories by Arun Menon on Medium</title>
            <link>https://medium.com/@menonarun23?source=rss-120ac21c59fb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 05:43:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@menonarun23/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Dependency Injection And IOC In Spring]]></title>
            <link>https://medium.com/@menonarun23/dependency-injection-and-ioc-in-spring-15bb28d4380e?source=rss-120ac21c59fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/15bb28d4380e</guid>
            <category><![CDATA[spring-ioc]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[ioc-container]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Arun Menon]]></dc:creator>
            <pubDate>Sun, 04 Jun 2023 12:55:24 GMT</pubDate>
            <atom:updated>2023-06-04T12:55:24.529Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQaY85ddRvy2rqigL946fg.jpeg" /></figure><h3>What is Dependency Injection?</h3><p>Dependency Injection is a design pattern. We will try to understand dependency injection with an example</p><p>Suppose we have two classes class A and class B, now for class A to do some work it needs the help of class B from this we can say that class A depends on class B to do some work.</p><p>If we were using JSP, Servlet, or writing a normal Java code, we would have simply created an object of class B inside class A with the help of a new keyword, but doing this will make it highly coupled.</p><p>Here comes the role of dependency Injection what dependency injection does is if class A depends on class B then the spring will automatically create the object of class B and inject it into class A.</p><p>The process where the control of creating an object we give that to Spring and it creates the object (the object will be created at runtime)on its own without any new keyword and injects this object to the needed class. This whole process is called Inversion Of Control(IOC)</p><h4><strong>Dependency Injection can be done in three ways</strong></h4><ol><li>Setter Injection/Property Injection.</li><li>Constructor Injection.</li><li>Field-Based Dependency Injection.</li></ol><h3><strong>Setter Injection</strong></h3><h4><strong>public class Address {<br> private String city;<br> private String state;<br> </strong><br> // Setters<br> public void setCity(String city) {<br> this.city = city;<br> }<br> <br> public void setState(String state) {<br> this.state = state;<br> }<br> <br> // Getters<br> public String getCity() {<br> return city;<br> }<br> <br> public String getState() {<br> return state;<br> }<br>}</h4><h4><strong>public class Student {<br> private String name;<br> private Address address;<br> <br> // Setters<br> public void setName(String name) {<br> this.name = name;<br> }<br> <br> public void setAddress(Address address) {<br> this.address = address;<br> }<br> <br> // Getters<br> public String getName() {<br> return name;<br> }<br> <br> public Address getAddress() {<br> return address;<br> }<br>}</strong></h4><p>From the above example, we can say that the Student class depends on Address Class as we are creating a private instance of type Address inside the Student class.</p><p>Now, when Spring needs to create an instance of the Student class, and if the Student class has a dependency on it, it will check its configuration and see that an Address bean is defined. Spring will then create an instance of Student and automatically inject the Address bean into the address property of Student. This process is called setter injection, where the dependency is resolved and set through a setter method.</p><h3><strong>Constructor Injection</strong></h3><h4><strong>public class Address {<br> private String street;<br> private String city;</strong></h4><h4><strong>public Address(String street, String city) {<br> this.street = street;<br> this.city = city;<br> }<br>}</strong></h4><h4><strong>public class Student {<br> private Address address;</strong></h4><h4><strong>public Student(Address address) {<br> this.address = address;<br> }<br>}</strong></h4><p>constructor injection in Spring allows you to declare dependencies in the constructor of a class and configure them in the Spring configuration. Spring will automatically create the necessary objects and inject them into the constructor when creating instances of the class. This promotes loose coupling, easier testing, and clearer dependency declaration.</p><h3>Field Based Dependency Injection</h3><h4><strong>public class BurgerWithFieldInjection {</strong></h4><h4><strong>@Autowired</strong></h4><h4><strong>private Patty patty;</strong></h4><h4><strong>public String getPattyType() {</strong></h4><h4><strong>return patty.getType();</strong></h4><h4><strong>}</strong></h4><h4><strong>}</strong></h4><p>Notice that no constructor or setter method is defined in this case. Spring will first try to find a constructor or a setter method. If there’s no constructor or setter method to inject the <em>Patty</em> bean, the container will use reflection to inject the dependency. For the reflection to work, the field must be annotated with <em>@Autowired.</em></p><h3>Application Context</h3><p><em>Is an Interface that represents a spring IOC container. The Spring framework provides several implementations of the</em><strong><em> ApplicationContext</em></strong><em> interface.</em></p><p><strong>ClassPathXmlApplicationContext</strong>: <em>This implementation loads the XML bean configuration file(s) from the classpath. It searches for the XML files in the application’s classpath and creates the bean instances based on the configuration defined in those files.</em></p><p><strong>FileSystemXmlApplicationContext</strong>: <em>This implementation loads the XML bean configuration file(s) from the file system. It specifies the absolute path(s) to the XML files and creates the bean instances accordingly.</em></p><p><strong>AnnotationConfigApplicationContext</strong>: <em>This implementation uses Java-based configuration instead of XML files. It relies on annotations, such as </em><em>@Configuration and </em><em>@ComponentScan, to define and discover the beans.</em></p><h4><strong>Advantages of Dependency Injection</strong></h4><ul><li>decoupling the execution of a task from its implementation.</li><li>making it easier to switch between different implementations.</li><li>greater modularity of a program.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15bb28d4380e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Servlet and JSP]]></title>
            <link>https://medium.com/@menonarun23/servlet-and-jsp-2eb83d934374?source=rss-120ac21c59fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/2eb83d934374</guid>
            <category><![CDATA[jsp]]></category>
            <category><![CDATA[jstl]]></category>
            <category><![CDATA[servlet]]></category>
            <category><![CDATA[jsp-servlet]]></category>
            <dc:creator><![CDATA[Arun Menon]]></dc:creator>
            <pubDate>Sun, 21 May 2023 16:06:20 GMT</pubDate>
            <atom:updated>2023-05-21T16:06:20.674Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*EdE3d6Esr7YDXEUG-fl6zw.png" /></figure><h3><strong>Introduction:</strong></h3><p>Servlets and JSP (JavaServer Pages) are fundamental technologies for building dynamic web applications in Java. They form the backbone of Java-based web development, allowing developers to create interactive and data-driven websites. In this blog, we will explore the basic concepts of Servlets and JSP, their roles in web development, and how they work together to deliver dynamic content to users.</p><h3>What are Servlets?</h3><p>Simply put, a Servlet is a Java program that runs on a web server and dynamically generates web content in response to client requests. It acts as a server-side component that handles the processing of HTTP requests and produces corresponding HTTP responses.</p><h3>The Lifecycle of a Servlet:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y3NZvp-2h4O3ec5JDZX0mg.png" /></figure><p>A Servlet follows a defined lifecycle, consisting of three main phases: initialization, request handling, and destruction. During initialization, the Servlet is loaded and its resources are set up. In the request handling phase, the Servlet processes incoming requests, performs any necessary logic or data manipulation, and generates a response. Finally, during destruction, the Servlet is unloaded and its resources are released.</p><h3>Working With Servlets:</h3><p>Creating a servlet is the same as creating a simple class in Java the only difference here is this class will extend the HttpServlet.</p><p><strong>HttpServlet :</strong></p><ol><li>HttpServlet is a class in the Java Servlet API that provides an abstract implementation of the Servlet interface specifically designed to handle HTTP requests and responses.</li><li>HttpServlet provides a convenient way to handle different types of HTTP requests (GET, POST, PUT, DELETE) by overriding the respective methods. For example, you can override the doGet() method to handle GET requests and doPost() method to handle POST requests.</li><li>HttpServlet provides access to HttpServletRequest and HttpServletResponse objects, which encapsulate the incoming HTTP request and outgoing HTTP response, respectively. These objects provide methods to retrieve request parameters, headers, and cookies, and handle response generation.</li><li>HttpServlet also provides methods such as init() and destroy(), which are called during the Servlet’s lifecycle for initialization and cleanup tasks.</li><li>HttpServlet can be configured and mapped to specific URL patterns using deployment descriptors (web.xml) or annotations like @WebServlet. This determines which requests should be handled by the servlet.</li><li>HttpServlet is the most commonly used servlet class for handling HTTP requests and building web applications in Java.</li></ol><h3><strong>Features Of Servlet :</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*V_qV8VsAphKUTKHZwwZXyA.png" /><figcaption>features of servlet</figcaption></figure><h4><strong>HttpSession In Servlet:</strong></h4><blockquote>The HttpSession in Servlet is an interface provided by the Java Servlet API that allows web applications to maintain stateful information about individual users across multiple HTTP requests. It provides a way to store and retrieve user-specific data throughout the duration of a user’s session on a website.</blockquote><h4><strong>Cookies In Servlet:</strong></h4><blockquote>Cookies in Servlets are small pieces of data that are stored on the client-side (user’s browser) and sent back to the server with each subsequent request. They are used to store information about the user or their interaction with the website.</blockquote><h4><strong>RequestDispatcher In Servlet:</strong></h4><blockquote>The RequestDispatcher interface in servlets provides a way to forward the request from one servlet to another servlet or include the response of another servlet in the current response. It is primarily used for servlet collaboration and dynamic resource sharing.</blockquote><h4><strong>Difference Between Cookies and Sessions</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*hkOHGNjN6Ac8Xd-_GIARPA.png" /><figcaption>Cookies vs Sessions</figcaption></figure><h4>Servlet Config</h4><blockquote>Servlet Config Object represents single servlet. It is like a local parameter associated with the particular servlet.getServletConfig() is used to get the config object.</blockquote><h4>Servlet Context</h4><blockquote>It represents the whole web application running on a particular JVM and is common for all servlets. It is like a global parameter associated with the whole application.getServletContext() is used to get the context object.</blockquote><h3>What is JSP?</h3><p>JSP (JavaServer Pages) is a technology used for creating dynamic web pages in Java. It allows developers to embed Java code within HTML/XML documents, enabling the generation of dynamic content on the server side.</p><h3>Why do we need it?</h3><p>We need JSP because it simplifies the process of building dynamic web pages by combining Java’s power with the ease of HTML/XML markup. It allows us to separate the presentation (HTML/XML) from the application logic (Java code), making it easier to maintain, reuse, and update web applications. JSP enables the creation of interactive and personalized web pages by dynamically generating content based on user input, database queries, or other dynamic factors.</p><h3><strong>JSP Tags:</strong></h3><h4><strong>Directive :</strong></h4><p>Directive tags provide general information about the JSP page to the JSP engine. A directive tag always starts with &lt;%@ and ends with %&gt;.</p><h4>There are three types of directives:</h4><ol><li>&lt;%@page %&gt;</li><li>&lt;%@include %&gt;</li><li>&lt;%@ tag lib %&gt;</li></ol><h4>Declaration :</h4><p>Declares and defines methods and variables outside the service method.</p><p>Syntax: &lt;%! variable declaration &amp; method definition %&gt;</p><h4>Scriptlet :</h4><p>Allows the developer to write free-form Java code on a JSP page. All the code inside this tag will be inside the servlet method.</p><p>Syntax : &lt;% some Java code %&gt;</p><h4><strong>Expression :</strong></h4><p>Used as a shortcut to print values in the output HTML of a JSP page.</p><p>Syntax: &lt;%= an Expression %&gt;</p><h3><strong>JSTL Tags :</strong></h3><ul><li><strong>Core Tags</strong></li><li><strong>Formatting tags</strong></li><li><strong>SQL tags</strong></li><li><strong>JSTL Functions</strong></li></ul><h3>Core Tags</h3><p>The core group of tags are the most commonly used JSTL tags. Following is the syntax to include the JSTL Core library in your JSP -</p><p>&lt;%@ taglib prefix= ”c” uri=”http://java.sun.com/jsp/jstl/core&quot; %&gt;</p><h4>Formatting tags</h4><p>The JSTL formatting tags are used to format and display text, the date, the time, and numbers for internationalized Websites. Following is the syntax to include the Formatting library in your JSP -</p><p>&lt;%@ taglib prefix= ”fmt” uri=”http://java.sun.com/jsp/jstl/fmt&quot; %&gt;</p><h4><strong>SQL tags</strong></h4><p>The JSTL SQL tag library provides tags for interacting with relational databases (RDBMSs) such as <strong>Oracle, mySQL</strong>, or <strong>Microsoft SQL Server</strong>.</p><p>&lt;%@ taglib prefix= ”sql” uri=”http://java.sun.com/jsp/jstl/sql&quot; %&gt;</p><h4>JSTL Functions</h4><p>JSTL includes several standard functions, most of which are common string manipulation functions. Following is the syntax to include the JSTL Functions library in your JSP -</p><p>&lt;%@ taglib prefix= ”fn” uri=”http://java.sun.com/jsp/jstl/functions&quot; %&gt;</p><h3><strong>Features of JSP :</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*PUo8SjqV8oK44CaS3bu8fw.png" /><figcaption>Features of JSP.</figcaption></figure><h3>Summary</h3><p>In summary, a Servlet is a server-side Java program that processes client requests, performs server-side operations, and generates dynamic web content as a response. It enables developers to create interactive and data-driven web applications by leveraging the capabilities of the Java programming language.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2eb83d934374" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Normalization In DBMS]]></title>
            <link>https://medium.com/@menonarun23/normalization-in-dbms-c33c1ef93e3d?source=rss-120ac21c59fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/c33c1ef93e3d</guid>
            <category><![CDATA[normalization]]></category>
            <category><![CDATA[database-normalization]]></category>
            <dc:creator><![CDATA[Arun Menon]]></dc:creator>
            <pubDate>Sun, 14 May 2023 11:51:02 GMT</pubDate>
            <atom:updated>2023-05-14T11:51:52.825Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-4i45wDyIppOaPSANyfwEQ.png" /></figure><h3>What is Normalization In Database?</h3><p>It is the process of designing a database effectively to avoid data redundancy(which means avoiding duplicity) which will help us to avoid anomalies such as</p><ol><li><strong><em>Insertion anomaly</em></strong>: It occurs when we cannot insert data into the table without the presence of another attribute.</li><li><strong><em>Update anomaly</em></strong>: It is a data inconsistency that results from data redundancy and a partial update of data.</li><li><strong><em>Deletion Anomaly</em></strong>: It occurs when specific attributes are lost because of the deletion of other features.</li></ol><h3><strong>Levels Of Normalization</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*jYBFqE6BO12Ty-Nl0ihedw.png" /></figure><p><strong>1NF( 1st Normal Form)</strong></p><p>1st rule:- Every column needs to have a single value.</p><p>2nd rule:- Each row should be unique either through single or multiple rows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*4Gk-ZAwxQvPmVSALaMQd0w.png" /><figcaption>before applying 1NF</figcaption></figure><p>In this employee table for the 1st row with column name phone Number has two values present which opposes the 1st rule. So we will create another row where we will store the second value present in the phone Number column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*qssciXvIOwQQclUyeBcWMA.png" /><figcaption>after applying 1NF</figcaption></figure><p><strong>2NF(2nd Normal Form)</strong></p><p>The first condition in 2NF is the table has to be in 1NF.</p><p>2nd rule:- should not consist of partial dependency. That is, all non-key attributes are fully dependent on a primary key.</p><p><em>In simpler words,</em></p><p>If a relation is in 1NF and all the attributes of the non-primary keys are fully dependent on primary keys, then this relation is known to be in the 2NF or the Second Normal Form.</p><p>When a candidate key’s subset determines the non-prime attributes, then we can call it a partial dependency.</p><p><strong>Candidate key:- </strong>A<strong> </strong>candidate key is a column or set of columns in a table that can be used to uniquely identify each row of data in the table</p><p><strong>Partial dependency:- </strong>A partial dependency occurs when a non-prime attribute (an attribute that is not part of any candidate key) is functionally dependent on only a portion of the primary key, rather than the entire key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*uTdJIEciae9h1HEvnf8w9A.png" /></figure><p>This table has a composite <a href="https://www.edureka.co/blog/primary-key-in-sql/">primary key</a><em> Employee ID</em><em>,Department ID</em>. The non-key attribute is <em>office location</em>. In this case, <em>office location </em>only depends on the <em>Department ID</em>, which is only part of the primary key. Therefore, this table does not satisfy the second Normal Form.</p><p>To convert this to 2NF we need to break the table into two parts which are</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*grjaLK8uBu-bJREzKSCJ6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*bkyOgqzUwq6inmIz9CNk6A.png" /></figure><p>As you can see we have removed the partial functional dependency that we initially had. Now, in the table, the column <em>office location</em> is fully dependent on the primary key of that table, which is<strong> </strong><em>Department ID</em>.</p><p><strong>3NF(3rd Normal Form )</strong></p><p>1st rule: The table has to be in 2NF.</p><p>2nd rule: There should be no transitive dependency for non-prime attributes.</p><p><strong>Transitive dependency: </strong>Transitive dependency occurs when a non-prime attribute depends on another non-prime attribute in a table.</p><p><strong>Non-prime attributes</strong>:-In database, a non-prime attribute is an attribute that is not part of any candidate key in a table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*ucFuRU2hrxCQmrfsNHrIEg.png" /></figure><p>In the above table, the<em> student Id </em>determines the <em>Subject Id</em> and <em>Subject Id</em> determines the <em>subject</em>. In another way, the <em>student id</em> determines the <em>subject</em> via the <em>subject id. </em>This means that we have a transitive functional dependency, and this structure does not satisfy the third normal form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*tcGUT9yibBcBVT87iDgaqw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*YHdL5P2pnDhHXLcfYwLeQA.png" /></figure><p>As you can see from the above tables all the non-key attributes are now fully functional dependent only on the primary key. In the first table, columns <em>Student Name</em><strong>, </strong><em>Subject ID</em> and <em>Address</em> are only dependent on <em>Student ID</em>. The second table <em>Subject</em> is only dependent on <em>Subject ID</em>.</p><p><strong>Boyce Codd Normal Form (BCNF)</strong></p><p>This is also known as 3.5NF.</p><p>In BCNF if every functional dependency is <strong>A → B</strong>, then <strong>A</strong> has to be the <strong>Super Key</strong> of that particular table.</p><p><strong>Super Key</strong>:- In database design, a superkey is a set of one or more columns in a table that can uniquely identify each row in that table. It can be a single column, a combination of columns, or even all columns in the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*e6dx5HsTr1c6wvyJehzIRg.png" /></figure><p>As you can see <em>Student ID,</em> and<em> Subject</em> form the primary key, which means the <em>Subject</em> column is a prime attribute<strong>.</strong> But, there is one more dependency, <em>Professor </em>→<em> </em><em>Subject</em>.</p><p>And while <em>Subject</em> is a prime attribute, <em>Professor</em> is a <strong>non-prime attribute</strong>, which is not allowed by BCNF.</p><p>Now in order to satisfy the BCNF, we will be dividing the table into two parts. One table will hold <em>Student ID</em> which already exists and a newly created column <em>Professor ID</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*AzSIpcO68jJTEyee8orzRw.png" /></figure><p>And in the second table, we will have the columns <em>Professor ID</em>, <em>Professor</em> and <em>Subject</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*fXrahFLv1E6pvz5EpQ89rA.png" /></figure><p>By doing this we are satisfied with the Boyce Codd Normal Form.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c33c1ef93e3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OOP’S Concepts In Java]]></title>
            <link>https://medium.com/@menonarun23/oops-concepts-in-java-25a7cd9f2b35?source=rss-120ac21c59fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/25a7cd9f2b35</guid>
            <category><![CDATA[oop-concepts]]></category>
            <category><![CDATA[oops-in-java]]></category>
            <category><![CDATA[java-oops-concept]]></category>
            <dc:creator><![CDATA[Arun Menon]]></dc:creator>
            <pubDate>Sun, 07 May 2023 12:15:58 GMT</pubDate>
            <atom:updated>2023-05-07T12:15:58.705Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is OOP?</strong></h3><blockquote>OOP stands for Object Orientied Programming.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*RWJIgr4y09G9I65FZFYnpA.jpeg" /></figure><p>Procedural programming is about writing procedures or methods that perform operations on the data, while object-oriented programming is about creating objects that contain both data and methods.</p><p>Object-oriented programming has several advantages over procedural programming:</p><blockquote>OOP is faster and easier to execute</blockquote><blockquote>OOP provides a clear structure for the programs</blockquote><blockquote>OOP helps to keep the Java code DRY “Don’t Repeat Yourself”, and makes the code easier to maintain, modify and debug</blockquote><blockquote>OOP makes it possible to create full reusable applications with less code and shorter development time.</blockquote><h4><strong>OOPS concepts in Java are as follows :</strong></h4><blockquote><strong>Class and Objects</strong></blockquote><h3>Class</h3><p>In Java Class is a template or blueprint that defines the properties and behaviours of an object. It specifies the data and methods that an object of that class will have.</p><p>For example, consider a class called “Person”. This class can have properties like name, age, address, etc. and methods like getName(), getAge(), setAddress(), etc. A class defines the common characteristics of all objects that belong to that class.</p><p>Class includes a special method called Constructor(Which have same name as that of class) and it is used to intiliaze an object.</p><p>There are three types of Constructor in Java</p><ol><li>Default Constructor: If you do not define any constructor for a class, Java will provide a default constructor for that class. This constructor takes no arguments and initializes all instance variables to their default values (e.g. null for reference types and 0 for numeric types).</li><li>Parameterized Constructor: A parameterized constructor is a constructor that takes one or more arguments. It is used to initialize the instance variables of an object with values provided by the caller. Parameterized constructors can be used to provide different ways of initializing objects, depending on the arguments passed to them.</li><li>Copy Constructor: A copy constructor is a constructor that creates a new object by copying the values of another object. It takes an object of the same class as an argument and initializes the instance variables of the new object with the values of the corresponding variables in the existing object.</li></ol><h3>Object</h3><p>An object, on the other hand, is an instance of a class. When you create an object of a class, you are creating a specific instance of that class. For example, if you create an object of the “Person” class, you are creating a specific person with a name, age, address, etc.</p><p>To create an object of a class, you use the “new” keyword followed by the name of the class and parentheses. For example, to create an object of the “Person” class, you would write:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*LawTc51CSyNoj8sM2IBUAw.png" /></figure><blockquote><strong>Encapsulation</strong></blockquote><p>Encapsulation is the mechanism of wrapping up data and code together in a single unit.It helps in data hiding and preventing unauthorized access to the data.</p><p>To acheive Encapsulation we declare a variable as private(when a method or variable is private we can access it within the same class) and provide Getter(A getter method, also known as an accessor method, is a public method that returns the value of a private field) and Setter(A setter method, also known as a mutator method, is a public method that sets the value of a private field) for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*YSqNQd6_EyvqoRnRu5JZyg.png" /></figure><blockquote><strong>Inheritance</strong></blockquote><p>Inheritance is the mechanism of creating a new class from an existing class. The new class inherits the properties and behaviours of the existing class and can add its own properties and behaviours.</p><p>we can achieve inheritance by using extend keyword.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*_0jLr-DeDnJlGaBsDrpd2g.png" /><figcaption>example of inheritance.</figcaption></figure><p>In inheritance a child class cannot extend the constructor and private method present in the parent class as constructor should have same name as class name and private method can only be accessed within the same class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*G0x2KklStGnazaVWhGB7Zg.png" /><figcaption>output of the above code.</figcaption></figure><blockquote><strong>Polymorphism</strong></blockquote><p>In Java, polymorphism refers to the ability of a class to provide different implementations of a method, depending on the type of object that is passed to the method. To put it simply, polymorphism in Java allows us to perform the same action in many different ways.</p><p>Two types of polymorphism in java :</p><ol><li><strong>Method Overloading</strong>(Compile Time, Static polymorphism).</li></ol><p>Method Overloading is a way to define multiple method in the same class with same name but with different number of input parameter or different type of input parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AOf_1V-lJEDS6kFvxQ52uA.png" /></figure><p>2.<strong> Method Overriding</strong>(Run Time , Dynamic polymorphism).</p><p>Method Overriding refers to the feature that allows child class to provide specific implementation of method that is already provided by the parent class.</p><p>When the method in child class as same name , same number of parameters, same type of parameters and same return type the we can say that method in the parent class is overrided by the child class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cuXK6hnIkgHvLIgz-ND-1w.png" /><figcaption>example of Method Overriding</figcaption></figure><blockquote><strong>Abstraction</strong></blockquote><h3>Abstract Classes and Methods</h3><p><strong>Abstraction</strong> is the process of hiding certain details and showing only essential information to the user.<br>Abstraction can be achieved with either <strong>abstract classes</strong> or <a href="https://www.w3schools.com/java/java_interface.asp"><strong>interfaces</strong></a><strong>.</strong></p><p>The abstract keyword used for classes and methods:</p><ul><li><strong>Abstract class:</strong> is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*zZN9ZFG-kVJQNRQLona37A.png" /></figure><ul><li><strong>Abstract method:</strong> can only be used in an abstract class, and it does not have a body. The body is provided by the subclass (inherited from).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jATkdjrWFmIg0zlCMxUKeQ.png" /></figure><h3><strong>Interface</strong></h3><p>An interface is a completely &quot;<strong>abstract class</strong>&quot; that is used to group related methods with empty bodies.</p><p>To access the interface methods, the interface must be “implemented” by another class with the implements keyword (instead of extends). The body of the interface method is provided by the &quot;implement&quot; class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IUNHG6wv5WO6cDlB4QmhGA.png" /></figure><blockquote><strong>Difference Between Interface and Abstarct class</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*qTSSQZEKgCuYxiap0v-swQ.png" /><figcaption>abstract class and interface</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25a7cd9f2b35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction]]></title>
            <link>https://medium.com/@menonarun23/introduction-98d51a08bd97?source=rss-120ac21c59fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/98d51a08bd97</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[learning-git]]></category>
            <category><![CDATA[git-commands]]></category>
            <dc:creator><![CDATA[Arun Menon]]></dc:creator>
            <pubDate>Sun, 23 Apr 2023 16:27:15 GMT</pubDate>
            <atom:updated>2023-04-23T16:43:03.043Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*Dar4ZS_fG2Oyt81PtVz4Gg.jpeg" /></figure><p>Git is a popular version control system that has become an essential tool for software developers worldwide. Whether you are a beginner just starting out or an experienced developer looking to level up your skills, mastering Git is crucial for efficient and collaborative software development. In this comprehensive guide, we will cover everything you need to know about Git, from basic concepts to advanced techniques.</p><h3>What is Git ?</h3><p>Git is a distributed version control system that allows developers to manage changes to their codebase, collaborate with other team members, and track the history of their code. It was created by Linus Torvalds, the same person who created the Linux operating system, and has since become the most widely used version control system in the world.</p><h3>Key Concepts of Git:</h3><h4>Before diving into the details of Git, let’s understand some key concepts:</h4><ol><li>Repository: A repository, often abbreviated as “repo,” is a collection of files and folders that make up a project. It is a central place where Git stores all the changes to the codebase and allows developers to collaborate and track the history of the project.</li><li>Commit: A commit represents a snapshot of the changes made to the codebase at a specific point in time. It is like a checkpoint that allows you to go back and forth in the history of your project.</li><li>Branch: A branch is a separate copy of the codebase that allows developers to work on different features or bug fixes independently. It helps to isolate changes and provides a safe space to experiment without affecting the main codebase.</li><li>Merge: Merging is the process of combining changes from one branch into another. It allows multiple developers to work on different branches and then merge their changes into a common branch, such as the master branch.</li><li>Pull Request: A pull request is a request to merge changes from one branch into another. It is a common workflow used in Git-based projects to review and discuss changes before they are merged into the main codebase.</li></ol><h3>Configuring Git:</h3><p>Configuring Git is an important step to getting started with Git. The first time when we use git we have to specify some configuration settings. You have to specify your Name, Email, Default editor and Line Ending.</p><h3>Configuring Git Command:</h3><p>$ git config — global <a href="http://user.name/">user.name</a> “Your Name”</p><p>$ git config — global <a href="http://user.email/">user.email</a> “<a href="/service/mailto:youremail@example.com">your-email@example.com</a>”</p><h4>Some Basic Git Commands Every Developer Should Know :</h4><ol><li>git init: Initializes a new Git repository in the current directory, creating a new .git directory that will store all the version control information for the repository.</li><li>git clone: Creates a copy of a remote repository on your local machine. You can specify the remote repository&#39;s URL as an argument, and Git will create a new directory with the same name as the remote repository.</li><li>git add: Adds changes or new files to the staging area, which is a temporary area where you can prepare changes to be committed. You can specify specific files or use git add . to add all changes in the current directory.</li><li>git commit: Creates a new commit with the changes in the staging area. You need to provide a commit message that describes the changes made in the commit.</li><li>git status: Shows the status of your local repository, including any changes that have been made but not committed, and any untracked files.</li><li>git log: Displays a log of all the commits in the repository, showing the commit hash, author, date, and commit message.</li><li>git diff: Shows the differences between the working directory and the most recent commit.</li><li>git pull: Fetches changes from a remote repository and merges them into the current branch. It&#39;s often used to update your local repository with changes from a shared repository.</li><li>git push: Pushes local commits to a remote repository, updating the remote repository with your changes. You need to specify the remote repository and branch you want to push to.</li><li>git branch: Lists all the branches in the repository and shows the currently checked-out branch.</li><li>git checkout: Switches to a different branch or commit. You can specify the branch or commit hash you want to switch to as an argument.</li><li>git merge: Merges changes from one branch into the current branch. You need to specify the branch you want to merge.</li><li>git fetch: Fetches changes from a remote repository but does not merge them. You need to use git merge or git rebase to integrate the changes.</li><li>git remote: Lists all the remote repositories connected to your local repository.</li></ol><h3>Resources :</h3><ol><li>Git Immersion :- h<a href="http://gitimmersion.com/">ttp://gitimmersion.com/</a>.</li><li>Official Git Documentation :- <a href="https://git-scm.com/docs">https://git-scm.com/docs.</a></li></ol><h3>Conclusion:</h3><p>Mastering Git is crucial for effective version control and collaborative software development. By following best practices, such as using descriptive commit messages, committing frequently, using branches, following the pull request workflow, using tags, keeping the repository clean, collaborating effectively, and backing up the repository, developers can optimize their workflow and ensure smooth development processes. Adopting these best practices will help teams work seamlessly together, manage changes effectively, and maintain a stable and reliable codebase.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98d51a08bd97" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>