Introduction to Java: Fast and Easy | Alexandru Rosu | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Introduction to Java: Fast and Easy

teacher avatar Alexandru Rosu, Technology matters

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

5 Lessons (16m)
    • 1. Introduction

      0:45
    • 2. Abstract Classes Presentation

      3:30
    • 3. Abstract Classes Code Examples

      4:18
    • 4. Interfaces Presentation

      3:04
    • 5. Interfaces Code Examples

      4:07
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

10

Students

--

Projects

About This Class

Hello,

Under the following class I will present an introduction to Abstract Classes and Interfaces in Java.

This main concepts will be described in both visual slides presentations (as per main ideas that students need to be aware of per each topic) in parallel to actual code examples that I created under a Java IDE (for students to follow).

Abstract classes and Interfaces are two of the most important concepts of the fundamentals of Java language.

By taking this class, even if you are a beginner or an advanced student, this will present the main particularities for both this important concepts from Java:

  • Java fundamentals core concepts
  • Beginners in Java Programming
  • Learning Java as a Novice
  • Fast Interview Preparation
  • Quick and Easy Introduction to Java

Happy learning

Meet Your Teacher

Teacher Profile Image

Alexandru Rosu

Technology matters

Teacher

Hi,

My name is Alex and I am happy to join skillshare as an teacher.

I have a bachelor degree in Computer Science and a Master Degree in Multi modal distributed virtual environments.

With a strong passion for programming, I enjoy finding solutions to various IT related problems.

My favorite programming language? I can tell you that it's Java, but I have also worked with other languages such as NodeJS, Angular, Typescript, Python, etc in my previous 10 years of experience.

Will be happy to share my knowledge and create great content for everybody who wants to join my classes.

Let's build awesome things together :)

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction: hi guys. And welcome to this job basic section where we will discuss the fundamentals off abstract classes and interfaces in Java. In the following class, you will see the main principles rules off Working with this important concepts off the Java language also will be pointing that out. The similarities and differences between these two specific particularities their corresponding role and we will also review some concrete examples off working with each one of them. So let's understand the basics off abstract classes and interfaces under Java language. 2. Abstract Classes Presentation: abstract classes. Main particularities, An abstract class, is defined using the keyword abstract. These jobs are concept defines variables used to keep the state often object. An abstract class can have both abstract and known abstract methods in an abstract class. It's not mandatory toe have abstract methods, but you have at least one abstract method in a class method that currently does not have on implementation. Defined for it, that glass needs to be defined as abstract on abstract, less can be instance, created using the keyboard new as he used for complete Java classes. A base class for an abstract class can be set also as an abstract class in order to define some implementations for particular methods inherited from the parent class, but also to prevent it from being instance sated on abstract class forces or non abstract classes. The rivet classes from the abstract class using the extents key work to provide an implementation toe. All abstract methods described in the parent abstract class on abstract class can be extended by both on abstract and known abstract classes. If an abstract class extends another abstract class, the derivative class is not supposed to implement or abstract methods inherited from the parent abstract class in the situation that an abstract class is it extended by a class that is not abstract, that the river class has to provide an implementation for each abstract method inherited from the parent class. Also, an abstract class can't define abstract. Static methods seem static. Methods belong to a class that not one object. This kind off methods can't be inherited. A metal that can be inherited can be implemented. Importance our own. The use off abstract classes provide improvements in terms off architecture design, Often application. Does the common elements often object that will extend the abstract? Classes can be dent ified. They are attached in an abstract class in the form off methods that provide an implementation and the particular elements off the river. Classes can be sent aside within the parent abstract class in the form of abstract metals and be implemented in each rivet class in a matter customized to each object. Now, since we have some basic so rules in place, let's look on some concrete examples off using abstract classes 3. Abstract Classes Code Examples: in the following video or presents some simple examples off using abstract classes in Java . For this purpose, I have set up a simple project that you can import in your favorite Java I d. In terms off abstract classes, specific Java examples, I configured three different exercises that I will present under the first example we can review a simple class that is marked as abstract. By using the abstract keywords, you can see that this class contains both on abstract and the known abstract corresponding methods. Following this example, I greeted the simple class called concrete class that extends the abstract class. Since this class is not a notated with the abstract keywords, it's mandatory for it to provide an implementation for the method inherited from the parent abstract class. Under the main method, we have a simple constructor in place where we instance it a new object by using the abstract last in the concrete class. After this will be able to invoke both the abstract method that the concrete class provides an implementation for and also the concrete method define directly under the abstract class . Results can be seen in the Council for the second example we prepare once again on Apstar class. This exposes a concrete method that we will bring to the council the corn date aspect. This video recording unimportant aspect to note is that abstract classes can't define abstract study methods. Asper, the class that extends the abstract class we don't define any particular methods, just inherited the one present under the abstract based class. In the main method for this example, we just instance she ate a new object and print the date toe the council window in a simple manner on the last example. For the abstract classes, we have multiple aspects set in place. The force abstract class will define an integer value, said Toe one, next one on abstract mattered. The second abstract class is mostly identical to the 1st 1 However, please note that we extend the initial abstract class. The only difference is just the integer value being instance hated value to for the concrete class. We extend the second abstract class and provide an implementation toe the method that is inherited so that it will print the value to the council. Now, under the main method, we create a concrete class object starting from the abstract Class One interface while painting the value to the council. You can see that we are paying the value, too. But why this might happen. Please note that the concrete class extends the abstract last you that has the value said to to for the integral reference, overriding the value from the abstract. Last one, also abstract Last two extends abstract Class one, and this is why I can instance heap a concrete class from abstract less. One reference. Even if this last example is a bit more complex, I wanted to point out the dynamic approach on how abstract classes can be used. 4. Interfaces Presentation: in their faces. Main particularities UN interface is the perfect example off separating the behavior that will be supported by an object from its actual implementation. It is used to define the characteristics often object that will implement the specified interface by defining a group off abstract methods or members. Variables and methods, often interface, are implicitly public. We can declare an interface using the interface keyword UN interface can only declare public final, and static variables as well as public and abstract mental on interface cannot extend the class UN interface can extend several interfaces. However, it cannot implement another interface. Given that an interface has only public methods, all interfaces the river from it. Extending the parent interface will inherit all methods off the parent interface. We can review the implementation often interface toe signing a contract When a concrete class, which is not abstract implements the respective interface, this class will have to implement all the metals off the interface. Otherwise, the code will not be able to compile on abstract class. On the other hand does not have to implement all the methods off the interface that implements it. Given that all methods often interface our public if we want to set a weaker access more the fire, private protected or the default one toe unimplemented method, this method will not be able to compile importance or all. As we all know, Jabhat does not support multiple inheritance. A class can extend any headed the elements off a single class. For this purpose. The interfaces can be used so class can implement several interfaces offering a specific implementation off each method off the matters to be developed, inherited from the corresponding interfaces security tell us on object can hide certain elements specific to it. Implemented methods by using an interface closer has access only toe The methods define in that interface. Since we have the main characteristics off interfaces, let's look on some concrete job I examples off using interfaces. 5. Interfaces Code Examples: We will now present some simple examples that will expose the basics off working with interfaces in Java. As you can see, I have configured three different examples off working with Java interfaces. For the first example, we declared a simple interface called Player. Using the keyword interface, this interface presents a simple method that will be configured under the class that will implement it. We have configured a simple concrete class that will implement the player interface and also provide a detailed implementation for its inherited that method. Under the main method, you can see how simple is going stand. She ate a new object based on the player interface and involved a single method that we configured under it. For the second example off. Working within their faces, we declared an interface called Animal. This interface presents an integer value and also two methods that will need to be implemented by concrete classes. As for concrete classes, we have in place a class called CAT, this class will implement the animal interface and will also inherit the age value from it . Age being on instance, value off this interface. As for the mentors that need to be implemented we see that we provide some implementations for both Make sound and print age methods. Also, Please note that under the print age method, we will also assign the age value to to moving to the next class. We can see that we created one called Dog that also implements the animal interface. You can see that we also have implementation defined for both methods. Unimportant aspect to note is that we can't reassign R value Toe the age reference in a direct manner, as the age reference is smart automatically as final in the animal interface. On the main method, we will instance E eight, both a cat and a dog using animal as an interface implemented by both classes. You can see the results off running this class in the system console window. But last example, in the interfaces section, we have declared a simple interface called Interface, one that has a simple metal defined. The second interface, called Interface to It's also identical in Terms off Meta Declaration toe the interface one Asper, the concrete class. This implements both interface one, an interface to since both interfaces have the same method, name and signature defined, we need to create only one implementation for the inherited method. Moving toe the main class. We can define a simple concrete class object by using either interface one or interface to , since the concrete class implements both off them. The result is straightforward and prince to the council a specific message. I hope you enjoyed this simple introduction on the basics off working with abstract classes and interfaces in Java.