<?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 Alikoaik on Medium]]></title>
        <description><![CDATA[Stories by Alikoaik on Medium]]></description>
        <link>https://medium.com/@alikoaik004?source=rss-91c965ae1b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Zav5l4UW6edCi2xR</url>
            <title>Stories by Alikoaik on Medium</title>
            <link>https://medium.com/@alikoaik004?source=rss-91c965ae1b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:36:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alikoaik004/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[Two Worlds of Programming — Medium-Level vs. High-Level]]></title>
            <link>https://medium.com/@alikoaik004/two-worlds-of-programming-medium-level-vs-high-level-78a0d3804e1a?source=rss-91c965ae1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/78a0d3804e1a</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[c-language]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[low-level-programming]]></category>
            <category><![CDATA[pointers-in-c]]></category>
            <dc:creator><![CDATA[Alikoaik]]></dc:creator>
            <pubDate>Sun, 16 Mar 2025 17:34:12 GMT</pubDate>
            <atom:updated>2025-03-18T15:47:44.157Z</atom:updated>
            <content:encoded><![CDATA[<h3>Two Worlds of Programming — Medium-Level vs. High-Level</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j5FxCvXD-WZK_7KP" /></figure><p>In this article, we will compare Java and C, not just from a syntax perspective, but by exploring their functional differences. By understanding how these languages handle memory, execution, and system interaction, we can gain a clearer perspective on when and why to use each one.</p><h3><strong>— Level of abstraction</strong></h3><p>The level of abstraction in a programming language determines how closely it interacts with the computer hardware.</p><ul><li><strong>C is called a mid-level language</strong> because it allows direct hardware access while also supporting structured programming. This makes it useful for system programming and embedded development.</li><li><strong>Java is a high-level language</strong> that hides system details and runs on the Java Virtual Machine (JVM). This makes it easier to use and allows the same code to run on different platforms.-</li></ul><h3><strong>— Top-Down Compilation in C</strong></h3><p>When the C compiler reads the code:</p><ol><li>It starts at the top and moves line by line.</li><li>If a function is called before its definition, the compiler doesn’t know it exists, resulting in an error.</li></ol><p>Example :</p><pre>int  main()<br>{<br>    greet();<br>    return (0);<br>}<br><br>void  greet()<br>{<br>    printf(&quot;Hello, World!\n&quot;);<br>}</pre><p>Why does this fail?</p><p>The compiler reaches greet()but hasn’t encountered void greet() yet.</p><p><strong>. This works perfectly in Java</strong> :</p><pre>public class Main {<br>    public static void main(String[] args) {<br>        greet();<br>    }<br><br>    static void greet() {<br>        System.out.println(&quot;Hello, World!&quot;);<br>    }<br>}</pre><ul><li>Java <strong>compiles the entire class at once</strong>, so it already knows that greet() exists before execution.</li><li>Java allows methods to be called <strong>before their definition</strong> in the same class</li></ul><h3>— Pointer</h3><p>Pointers are a key concept in C but do not exist in Java in the same way. Let’s explore what pointers are, how they work in C, and why Java avoids them</p><ul><li>A <strong>pointer</strong> is a variable that stores the <strong>memory address</strong> of another variable. Instead of storing actual values, pointers store locations where values are stored.</li></ul><pre>int main()<br>{<br>    int num = 10;<br>    int *ptr = &amp;num;<br><br>    return 0;<br>}</pre><h4>Why Are Pointers Important in C ?</h4><ul><li><strong>Direct Memory Access</strong> — Access and modify variables via memory addresses.</li><li><strong>Efficient Function Arguments</strong> — Pass large data structures using pointers instead of copying them.</li><li><strong>Dynamic Memory Allocation</strong> — allows programs to allocate memory at runtime, instead of defining fixed memory sizes at compile time.</li><li><strong>Data Structures</strong> — Essential for implementing <strong>linked lists, trees, and graphs</strong>.</li></ul><h4>Why Doesn’t Java Have Pointers?</h4><p>Java removes direct memory access to <strong>prevent errors and security risks</strong>. Instead, Java uses <strong>references</strong>, which work similarly to pointers but without pointer arithmetic and manual memory management.</p><h3>— String</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrlxzL7VxlC9GKSj3UZ5iQ.png" /></figure><p>Unlike Java, C does not have a built-in string type. Instead, strings are represented as character arrays ending with a special character called the null terminator (\0)</p><p>in c :</p><pre>int main() <br>{<br>    char str[] = &quot;Hello&quot;;<br>    str[0] = &#39;A&#39;;  // Modifying first character<br>    <br>    return 0;<br>}</pre><p>in java :</p><pre>public class StringFunctions {<br>    public static void main(String[] args) {<br>        <br>        String str = &quot;Hello, World!&quot;;<br><br>        // Get Length<br>        str.length();<br><br>        // Concatenation<br>        String newStr = str.concat(&quot; Welcome!&quot;);<br><br>        // String Comparison<br>        String str2 = &quot;hello, world!&quot;;<br>        str.equals(str2);            // Output: false<br>        str.equalsIgnoreCase(str2);  // Output: true<br><br>        // Convert Case<br>        System.out.println(str.toUpperCase());  // Output: HELLO, WORLD!<br>        System.out.println(str.toLowerCase());  // Output: hello, world!<br>    }<br>}</pre><h3>— Memory Management</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ad1-yldoxzTpupDb1C6kg.png" /></figure><ul><li><strong>Manual Memory Management: </strong>In C, programmers must manually allocate and free memory using functions like malloc() and free(). This gives more control but also increases the risk of memory leaks and crashes.</li><li><strong>Automatic Memory Management</strong>: Java has automatic garbage collection, which removes unused objects from memory. This reduces memory-related errors but can slow down performance.</li></ul><h4>Static Memory Allocation</h4><p>memory is assigned <strong>at compile time</strong>, and the allocated size <strong>cannot change</strong> during program execution.</p><p><strong>Example :</strong></p><pre>    int arr[5] = {1, 2, 3, 4, 5};  // Fixed size array (5 elements)</pre><h4>Dynamic Memory Allocation</h4><p>dynamic memory allocation allows us to request memory at runtime, which is useful when the required size is not known beforehand.</p><p><strong>Example :</strong></p><pre>int* allocateArray(int size) <br>{<br><br>    int *arr <br><br>    arr = (int*)malloc(size * sizeof(int));<br><br>    // Checking if allocation was successful<br>    if (arr == NULL) <br>    {  <br>        printf(&quot;Memory allocation failed!\n&quot;);<br>        return NULL;<br>    }<br><br>    // Initializing array with values<br>    for (int i = 0; i &lt; size; i++) {<br>        arr[i] = i + 1;<br>    }<br><br>    return arr;  // Returning pointer to allocated memory<br>}<br><br>int main() <br>{<br>    int size = 5;<br>    int *arr = allocateArray(size);  // Calling function to allocate memory<br><br>    // Now &#39;arr&#39; is a dynamically allocated array of size &#39;size&#39;<br>    // We can use &#39;arr&#39; as a normal array but with flexible size<br><br>    // Free the allocated memory<br>    free(arr);<br>    <br>    return 0;<br>}</pre><h3>— Object-Oriented Programming</h3><p>One of the fundamental differences between Java and C is that <strong>Java is an object-oriented programming (OOP) language</strong>, while <strong>C is a procedural language</strong>.</p><p>Java is designed around the concept of objects and classes. It supports key OOP principles such as <strong>encapsulation, inheritance, and polymorphism</strong>, allowing code reusability, modularity, and flexibility.</p><p>C follows a <strong>top-down approach</strong>, where the focus is on functions and procedures rather than objects. It lacks built-in support for objects, classes, and other OOP features.</p><h3>— struct vs class</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1_yPu81AtSU8N1Vu" /></figure><p>In C <strong>struct (</strong>structure<strong>)</strong> allows grouping different types of data under one name.</p><p>Example :</p><pre>// Defining a struct : <br><br>struct Car {<br>    char model[20];<br>    int year;<br>};<br><br>int main() {<br><br>    struct Car car_1;<br><br>    // Assigning values<br><br>    strcpy(car1.model, &quot;Toyota&quot;);<br>    car1.year = 2020;<br><br>    return 0;<br>}</pre><p>In this example, the <strong>struct </strong>allows grouping related data (model and year), but it cannot include functions or access control like a class in Java.</p><p>In contrast, Java classes not only store data but also define methods and control access using encapsulation, which makes Java a true object-oriented language.</p><h3>— conclusion</h3><p>Java and C serve different purposes due to their unique approaches to programming. C’s level access makes it ideal for system programming, while Java’s object-oriented nature and platform independence make it perfect for scalable application development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78a0d3804e1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[— Web Development Over View]]></title>
            <link>https://medium.com/@alikoaik004/web-development-over-view-870c5e98cf5a?source=rss-91c965ae1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/870c5e98cf5a</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Alikoaik]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 14:03:13 GMT</pubDate>
            <atom:updated>2024-06-27T14:03:13.038Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lKgcLIMUUQj1qBqMOnd6zg.png" /></figure><h3><strong>What is web development ?</strong></h3><p>The process of creating websites and web application that run on the internet or an intranet (Private network) is called web development. it encompasses a broad range of tasks and skills.</p><p>_________________________________________________________________</p><h3><em>Key components of web Development</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oqc1VdskT3cZyutzb7-_BA.png" /></figure><p>Web Development involves three main parts :</p><h4><strong>— Front-End</strong></h4><p>Front-end is about creating what users see and interact with on a website using HTML, CSS, and JavaScript.</p><h4>— Back-End</h4><p>Back-end deals with the behind-the-scenes logic, databases, and server-side. programming using languages like PHP or Python.</p><h4>— Full-Stack</h4><p>Full-stack combines both front-end and back-end skills.</p><h4>“Let’s dive deeper into this :</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*d-VYXGx6f8KGeduhZkGQyw.jpeg" /></figure><p><strong>— &lt;/HTML&gt; : Hyper Text Markup Language</strong></p><p>Defines the structure and content of web pages using tags</p><pre><br>Example : <br><br> &lt;html&gt; <br>    Hello World<br>&lt;/html&gt;<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*MycwxPWNE_m9zWe1-kIuOQ.png" /></figure><pre>&lt;html&gt; <br>    &lt;body&gt;<br>      &lt;div class=&quot;Container&quot;&gt;<br>        Hi!<br>      &lt;/div&gt;<br>    &lt;/body&gt;<br>&lt;/html&gt;</pre><p>— Let’s begin adding some CSS to it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HNWsfJgBLFH5KqJzgFO8cQ.png" /><figcaption>Cascading Style Sheets</figcaption></figure><pre>.Container {                        <br>        width: 100px;<br>        height: 90px;<br>        color: blue ;<br>        background-color: red ;<br>        font-size: xx-large;<br>    }<br><br>OutPut : </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*OGewsk6y2o-z54NcTk3LfA.png" /></figure><p>To position components on a webpage accurately, it’s important to learn Flexbox and Grid.</p><pre>.Container {<br>        width: 100px;<br>        height: 90px;<br>        color: blue ;<br>        background-color: red ;<br>        font-size: xx-large;<br><br>        //arranging items inside a container along a single or multiple axes<br>        display : flex ; <br>        <br>        justify-content: center; // x-axies<br>        align-items: center; // Y-axies<br>    }<br><br>OutPut :</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*fjxLF-13zkE8OitoXkaN-w.png" /></figure><p><strong>— This is an example of the </strong><strong>&lt;table&gt; tag :</strong></p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br><br>&lt;head&gt;<br><br>  &lt;title&gt;Small Table Example&lt;/title&gt;<br>  &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;<br><br>&lt;/head&gt;<br><br>&lt;body&gt;<br><br>&lt;table&gt;<br><br>  &lt;thead&gt;                  // the top line of the table <br>    &lt;tr&gt;                   // table row<br>      &lt;th&gt;Product&lt;/th&gt;     // to select section and the text be boled<br>      &lt;th&gt;Price&lt;/th&gt;<br>    &lt;/tr&gt;<br>  &lt;/thead&gt;<br><br>  &lt;tbody&gt;                  // table body <br>    &lt;tr&gt;                   <br>      &lt;td&gt;Product A&lt;/td&gt;   <br>      &lt;td&gt;$20&lt;/td&gt;<br>    &lt;/tr&gt;<br><br>    &lt;tr&gt;<br>      &lt;td&gt;Product B&lt;/td&gt;<br>      &lt;td&gt;$30&lt;/td&gt;<br>    &lt;/tr&gt;<br><br>    &lt;tr&gt;<br>      &lt;td&gt;Product C&lt;/td&gt;<br>      &lt;td&gt;$25&lt;/td&gt;<br>    &lt;/tr&gt;<br><br>  &lt;/tbody&gt;<br><br>&lt;/table&gt;<br><br>&lt;/body&gt;<br>&lt;/html&gt;</pre><pre>table {<br>    width: 100%;<br>    border-collapse: collapse ;<br>  }<br>  <br>  th, td {<br>    border: 1px solid #dddddd;<br>    text-align: left;<br>    padding: 8px;<br>  }<br>  <br>  th {<br>    background-color: #f2f2f2;<br>  }</pre><p><strong>output </strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*olzbrwv7RXjhZmE6oVanNQ.png" /></figure><p>Use :</p><pre>th, td {<br><br>text-align: center;      <br><br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XyMBqWsKPZIW1W0sBEjjJA.png" /></figure><h4>Let’s talk about box-sizing in CSS</h4><ul><li><strong>Margin</strong>: “Space outside the element’s borders.”</li><li><strong>Padding</strong>: “Space inside the element’s borders.”</li><li><strong>Border</strong>: “Outline around the element’s content.”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*tZHK33Cgny3eYCXFs79L4w.jpeg" /></figure><p>We can specify the margins, padding, or borders individually for the top, bottom, left, and right sides.</p><h3>— JavaScript</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ki8mRiKpOjICkDXET1otUA.jpeg" /></figure><p>JavaScript is a programming language used to make web pages interactive. It helps in creating dynamic features like</p><ul><li>animations</li><li>check for errors before sending data to a server</li><li>Form Validation</li></ul><p>JavaScript is essential for building modern websites and web applications, allowing developers to create engaging experiences for users.</p><p><strong>Example :</strong></p><pre>&lt;body&gt;<br><br>&lt;h2&gt;Click the button to change the text color!&lt;/h2&gt;<br><br>&lt;p id=&quot;text&quot;&gt;This text can change color.&lt;/p&gt;<br><br>&lt;button onclick=&quot;changeColor()&quot;&gt;Change Color&lt;/button&gt;<br><br>&lt;/body&gt;</pre><pre>body {<br>    font-family: Arial, sans-serif;<br>    text-align: center;<br>    margin-top: 50px;<br>  }<br>  button {<br>    padding: 10px 20px;<br>    font-size: 16px;<br>    cursor: pointer;<br>  }</pre><pre>function changeColor() {<br>  var textElement = document.getElementById(&quot;text&quot;);<br>  textElement.style.color = &quot;red&quot;;<br>}<br><br>// </pre><p>output :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*P7u25xdify7C4Db8d9OV3Q.gif" /></figure><p>In this example, clicking the “Change Color” button triggers the &quot;changeColor()&quot; function, which changes the color of the paragraph text (“&lt;p&gt;“ with id=&quot;text&quot;) to red using JavaScript&#39;s DOM manipulation capabilities.</p><h3>— JQuery</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*Fkwc1F88K_LmBLNfSIYM8g.png" /></figure><p>jQuery is a JavaScript library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. It simplifies complex tasks and makes it easier to write JavaScript code that works across different web browsers.</p><h3>— Web FrameWorks</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P9swEiGEOi_o_igm-rMN3Q.jpeg" /></figure><p>We have a variety of web frameworks for both front-end and back-end development. These frameworks simplify the process of building web applications by providing pre-written code and structure.</p><p>Here are some of the most important and widely used web frameworks :</p><ul><li><strong><em>Bootstrap</em></strong><em> </em>: front-end framework for building responsive and mobile-first websites and web applications. It includes CSS and JavaScript components, such as layouts, typography, forms, buttons, navigation, and other interface elements.</li><li><strong><em>React.js</em></strong><em> : </em>Developed by Facebook, React is a JavaScript library for building user interfaces, focusing on component-based development and virtual DOM rendering</li><li><strong><em>Angular :</em></strong> Developed by Google, Angular is a comprehensive front-end framework that provides tools and components for building single-page applications (SPAs) and dynamic web apps.</li><li><strong><em>Flask</em></strong> : is designed to be lightweight and flexible framework for Python, It’s like a toolbox with tools and rules to make it easier to create websites. Flask gives you the basic pieces you need, like ways to handle web pages (URLs), show content to users, and manage data.</li><li><strong><em>Django </em></strong>: is a Python framework designed for developing larger and complex applications that require built-in features and scalability.</li></ul><h3>— Conclusion</h3><p>In conclusion, web development involves building websites and apps. Frameworks like Flask and Django help manage the behind-the-scenes stuff, making it easier to handle data and build bigger projects. With tools like Bootstrap and jQuery, developers can create responsive and interactive websites more efficiently. Keep exploring and learning to stay up-to-date in this ever-changing field of web development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=870c5e98cf5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object-Oriented Programming]]></title>
            <link>https://medium.com/@alikoaik004/object-oriented-programming-8f6e60a6d904?source=rss-91c965ae1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f6e60a6d904</guid>
            <category><![CDATA[objectorientedprogramming]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[oop]]></category>
            <dc:creator><![CDATA[Alikoaik]]></dc:creator>
            <pubDate>Fri, 28 Apr 2023 22:21:34 GMT</pubDate>
            <atom:updated>2023-04-28T22:37:32.978Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>in java :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*YQIVsFyYPrrVkrBNQRQ2zg.jpeg" /></figure><p>1- Object-Oriented Programming is a way of writing computer programs that makes it easier to organize and manage complex code, Instead of writing long, complicated functions to perform a task, OOP breaks the code down into smaller, reusable parts called “objects”.</p><p>2- OOP also makes use of “classes”, A class is like a set of instructions for creating an object and you can create multiple objects from the same class.<br>Think of a class like a recipe for baking a cake. The recipe tells you what ingredients you need, how much of each ingredient to use, and what steps to take to mix them together and bake the cake. In the same way, a class tells the computer what properties (like size, color, or speed) an object should have and what actions (like “move”, “jump”, or “talk”) it can perform.</p><ul><li><strong>Now, how can we create an object?<br></strong>the first step is to create a class and write the properties (Data Fields)</li></ul><pre>public class Car () {<br><br>int year ;<br>String color ;   <br>String model ;   <br><br>}</pre><p>3- A constructor is a special method in a class that is used to create and initialize objects of that class. It has the same name as the class and no return type, and it is called automatically when an object of the class is created using the “new” keyword. <br>In Java, if a class does not define any constructors, then a default constructor is automatically provided, which takes no arguments and simply initializes any instance variables to their default values.</p><pre>//the default constructor<br>public Car () {<br><br>}<br>// constructor take as an input the year <br>public Car (int year){<br>  this.year = year ;<br><br>/* this :  It is used to access the data fields and methods<br>           of the current object                         */<br>}</pre><p>4- to create a Car object, you would write:</p><pre>Car myCar ; <br>// you use the &#39;new&#39; keyword<br>myCar = new Car();        // the default constructor <br>myCar = new Car(2006);    // the second one</pre><h3><strong>Inheritance and Polymorphism</strong></h3><p>1- Inheritance is a mechanism that allows a class to inherit properties from another class .<br>the class inherits all Fields, Methods and Constructors regard which of them visible to the subclass ( they are public, protected, or private ) .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4tUAyjLLLgZ_B1-WcWjrRw.jpeg" /></figure><p>Inheritance is implemented by creating a new class that is derived from an existing class, using the extends keyword :</p><pre>//----------class Vehicle----------//<br>public class Vehicle {<br><br>String model;<br>int year ;<br><br>// constructors<br>// other methods<br>}<br><br>//----------class Car----------//<br>public class Car extends Vehicle {<br><br>int numDoor ;<br>boolean isSedan ;<br><br>public Car (int NumberOfDoors) {   // constructor <br>super();<br>this.numDoor = NumberOfDoors ;<br>this.isSedan = false ;<br>}<br><br>}</pre><p>super refers to the parent class of a subclass. It is used to call the constructor or a method of the parent class .</p><p>2- Polymorphism refers to the ability of objects to take on multiple forms, it allows different objects to be treated as if they are the same type of object .<br>This allows for more flexible and reusable code .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UoUn95uPgvY_0FFJ5CF1OQ.jpeg" /></figure><pre>// ** class Animal already created .<br>class dog extends Animal {<br>speak(){ print(&quot;woof&quot;); }<br>}<br>class Cat extends Animal {<br>speak(){ print(&quot;Meow&quot;); }<br>}<br>class cow extends Animal {<br>speak(){ print(&quot;Moo&quot;); }<br>}<br><br><br>Animal A1 = new dog();  <br>Animal A2 = new cow();<br><br>A1.speak();  // is a error beacause animal don&#39;t have speak method<br>( (dog) A1 ).speak();  // &quot;Woof&quot;<br>( (cow) A2 ).speak();  // &quot;Moo&quot;</pre><p>Polymorphism can be achieved through method overloading or method overriding, where methods with the same name can be defined in different classes to perform different actions.</p><h3><strong>Abstract Class :</strong></h3><p>1- An abstract class cannot be used to create objects directly but to inherit from it the properties ( fields , method … ) .</p><pre>abstract class test {<br>}</pre><p>→ Can have abstract and non abstract methods <br> → Abstract methods must be implemented in a Child class (subClass)</p><blockquote>Example :</blockquote><pre>abstract public class Fruit {<br>String name ;<br><br>  public Fruit (String name ){ this.name = name }<br><br>  public abstract void eat() ;   // the abstract method <br><br>}<br><br><br>public class Banana extends Fruit () {<br>// additional properties specific to bananas<br><br>  public Banana (String name , String color , boolean isRipe ){<br>  super (name , color , isRipe ) ;<br>    }<br>  public void eat () {<br>  System.out.println(&quot;Peeling and eating the &quot;+this.name+&quot; banana.&quot;)<br>    }<br><br>}<br><br>//-----------main-----------//<br>Banana myBanana = new Banana(&quot;Cavendish&quot;, &quot;Yellow&quot;, true);<br>myBanana.eat();<br><br>//output --&gt; Peeling and eating the Cavendish banana.</pre><h3>In the end</h3><p>There are many ideas not mentioned here like “Interface”, “Encapsulation”, “data abstraction” and others .<br>But it is a very important collection of ideas .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f6e60a6d904" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>