Libraries, interface, classes and methods

Asked

Viewed 1,492 times

9

What’s the difference between libraries and interfaces?

For example, on the line:

import java.util.Scanner;

The util would be the interface and Scanner the class? Or the util would be the library and the Scanner would still be the class?

In the case of methods with @Override only makes sense when working with interfaces? In case with inheritance I don’t know if it has so much reason.

1 answer

11


The terms are completely wrong and mixed.

There is a relationship between class and interface.

Library is a generic term that is not used in the code itself. What you are probably talking about are the packages (Packages).

So in the example the java.util is the package. And Scanner is the class.

At no time are you using interface there. More information. When to use.

Behold how to use the @override. More information.

  • Aren’t packages the folders that separate classes within src? So the library is more like a dependency than being part of the code itself?

  • 1

    Yes, they are. I would say better, that packages add classes. Your idea is right but the term is wrong. One can say that the library is a set of compiled packages. And of course there is the dependency.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.