Questions tagged [implements]

`implements` is a keyword in several programming languages used to denote implementation of an interface.

implements is a keyword in several programming languages which support OOP (such as Java or PHP) used to denote interface implementation (as opposed to extends used to denote implementation inheritance).

Related

404 questions
1
vote
1 answer

Java: Short form to create an instance of a class that implements an interface

I'd like to use the new operator to create an instance of JPanel that implements ActionListener and directly overrides the actionPerformed method. I tried JPanel panel = new JPanel implements ActionListener() { @Override public void…
DonFuchs
  • 371
  • 2
  • 14
1
vote
1 answer

Class decorator, how to make sure the class is extending and implementing other classes

Sorry for the weird title, I don't quite know how to describe what I'm trying to do in one sentence. I have to define a bunch of classes that are all going to extend from this one class and also implement this other class. class SoulCoughing extends…
snowfrogdev
  • 5,963
  • 3
  • 31
  • 58
1
vote
4 answers

How to pass object into implements and pass out the local object?

How do I pass a object to an implement and pass the local object to object that is outside? I think the SwingUtilities.invokeLater is nessasary for a Swing object , right? Sensors sens = new Sensors(); SwingUtilities.invokeLater(new Runnable()…
wizztjh
  • 6,979
  • 6
  • 58
  • 92
1
vote
3 answers

java interface avoid casting

I have two classes. An interface class "Node" and "Nodegraph" that implements "Node". "Node" has one parametric method, add, where I use Node node as paramenter. In NodeGraph, I need to casting (NodeGraph) node in order to use NodeGraph object. Is…
Gianni Spear
  • 7,033
  • 22
  • 82
  • 131
1
vote
3 answers

java getting error while using implements

Am new to java so please help me to solve my problem. Here is my code for printing the reciept bill public class BillPrintable implements Printable{ public int print(Graphics graphics,PageFormat pageformat,int pageIndex)throws PrinterException …
user_777
  • 845
  • 1
  • 9
  • 25
1
vote
2 answers

what does following Java line of code means

I found this class in magnolia CMS source which uses class definition I am not yet familiar with. Could anyone having knowledge about usage of the following code style explain to me what exactly this does? In this code sample RenderingModel and…
KItis
  • 5,476
  • 19
  • 64
  • 112
1
vote
1 answer

UML reduce number extend and implement connections

I have a project in which a lot of classes extends and/or implements a class and/or an interface. It already is splitted in logical components, but yet sometimes all of those connections make the diagrams messy. Is there a way to reduce this number…
user3418803
  • 189
  • 1
  • 7
1
vote
2 answers

Detecting Class of an object implementing an interface

I'm writing a game, as part of this players should be able to click on various GUI items and see further details on a specific area of the GUI. I'm mangaing this through an interface Detailable which is implemented by suitable game obects and sends…
MrB
  • 818
  • 8
  • 28
1
vote
1 answer

Implementing an OnClickListener?

I am trying to do something similar to that of the android lock screen pattern. I have a class that extends a view that I create multiple instances of. These appear on the screen all at once. I need to be able to click on them individually and have…
Eweb
  • 71
  • 1
  • 12
1
vote
0 answers

Implementing LinkedList.java class to My Main Driver class to use the get and remove method?

I am currently doing a code that tries to implement a separate LinkedList.java class to my main driver class. After doing that I will then show the output and ask the user to remove one of the elements stored inside the linkedlist and then show the…
aldz24
  • 65
  • 8
1
vote
1 answer

c# - How to implement a non generic interface in a generic class with constraints

Here is my code: public interface ICar { CarModel Property { get; set; } CarModel Method(); } public Car : ICar where T : CarModel { T Property { get; set; } T Method() { //Do Stuff } } I have implemented the…
Sam Henry
  • 83
  • 7
1
vote
2 answers

why used to interface rather than class in below condition.

i want to show a name.name may be in uppercase or in lowercase this will be depend on which class i will pass.i have to approach one is using class and second is interface which one is better and why ? Solution using Class class User{ } class…
shivani parmar
  • 314
  • 2
  • 17
1
vote
2 answers

Where would I implement an ActionListener?

Where would I implement the following code? By where I mean do I make a new class? Put it in the constructor of my main class? etc. public interface ActionListener extends EventListener { void actionPerformed(ActionEvent e); }
zmi
  • 11
  • 3
1
vote
1 answer

android datepickerfragment transfer information to main activity

I'm new in programming and android. I'm having problem with a datePickerfragment. Error when implementing DatePickerFragment.OnFragmentInteractionListener on mainActivity, it says that "Class MainActivity must either be declared abstract or…
Ulla
  • 70
  • 9
1
vote
2 answers

Why we use @Override while implementing a method from Interface ? Does it really Override the method?

While we use any method from the interface it asks us to override all unimplemented method. also we are using '@Override' annotation while implementing the method. Does it really called overriding ? because interface contains only method…
Ram Patro
  • 121
  • 4
  • 10