Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

It would be great if anybody could help me with this! thank you in advance! 1) D

ID: 3822133 • Letter: I

Question

  It would be great if anybody could help me with this! thank you in advance!  1) Describe the difference between inheritance (extends) and interfaces (implements) in Java.  2) What is meant by the phrase "impedance mismatch" when discussing objects and relational databases?  3) What is the advantage of using Maven in a Java project?  4) What are the major differences between an array declared as      int[] array = new int[10];  and an array declared as      ArrayList<Integer> array = new ArrayList<Integer>();  5) What is the purpose of the @Override tag you see in Java code?  -------------  Provide a definition and a short example if needed for clarity.  1) JDBC 2) enhanced for loop 3) conditional 4) UML 5) relational database 

Explanation / Answer

Please upvote if it helps you :) Thanks


1.

Warm Up Defintions
- extends keyword is used to extend a base class, either to add more functionalities to it or to use the ones provided by it. Java doesn't allow to extend multiple classes.
- implements keyword is used to implement an interface. We can implement multiple interfaces in Java.

Explanation
   "extends" is used when you are inheriting a parent class which is either fully or partially (abstract class) implemented, so that you can either add more functionalities to it or use the functionalities provided by the base class. Java doesn't allow multiple inheritance for classes. To overcome this, we have the concept of "interface implementation". An interface is just a blueprint of a class and can contain only abstract methods. These abstract methods are "implemented" in the class that "implements" the interface. Java allows a class to use multiple interfaces.

Example for extends

class Rectangle {
  
   protected int length, breadth;

   public Rectangle(int length, int breadth) {
       this.length = length;
       this.breadth = breadth;
   }

   public void getArea() {
       return length * breadth;
   }
}

/*
* A square is just a rectangle with same length and breath
* Square will inherit all the functionalities of Rectangle
*/
class Square extends Rectangle {
  
   public Square(int side) {
       super(side, side); // call constructor of rectangle
   }
}

Example for implements

/*
* A crocodile can be both, an aquatic animal and land animal
*/
public interface Aquatic {

   public void swim();
}

public interface Land {

   public void walk();
}

public Crocodile implments Aquatic, Land {

   public void swim() {
       // ..... method body
   }  

   public void walk() {
       // ..... method body
   }
}


--------------------------------------------------------------------------------------------------------------


2. impedance mismatch
   In object oriented programming, we map objects/class definitions to the database tables/relational schema. Impedance mismatches are the technical and conceptual difficulties that are involved when doing such mapping. Objects can be referenced by one another and so therefore can be thought of as a graph. Mapping of these complex data objects to tabular rows, is very hard and creates performance disavantages. When you combimne object and relational technology, they don't work seamlessly as they don't have same underlying paradigms.

---------------------------------------------------------------------------------------------------------------


3. Maven is a powerful project management tool that is used for building projects, documentations and dependencies. It enforces modular design of the code by making it easy to manage multiple projects and weaving them together. When dealing with small projects managing dependency can be simple, but when you are woking with huge projects with hundreds and thousands of dependencies, it becomes a quite mess to handle it. Maven simplifies the dependency management and lets you get the package dependencies easily.


-----------------------------------------------------------------------------------------------------------------

4. Array is a fixed length data structure whose size cannot be changed once it is declared. ArrayList are dynamic in size and their size grows as more and more elements are added to them. Another important difference is that ArrayLists cannot contain primitive data types, where as arrays can contain both primitive data and Objects.


--------------------------------------------------------------------------------------------------------------------

5.
@Override lets the compiler know that you are trying to override a method from super class. This let the compiler make a check and let you know if you are making any silly mistakes in the method signatures.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote