The Artima Developer Community
Sponsored Link

Java Answers Forum
Abstract class and polymorphism

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
DAYO

Posts: 22
Nickname: done
Registered: Jun, 2002

Abstract class and polymorphism Posted: Jun 7, 2002 5:06 AM
Reply to this message Reply
Advertisement
DYNAMIC BINDING
I am writing a JAVA(SWING/GUI) program that recognises certain commands.Users will enter command and the program executes the command.I want to be able to add commands in future.I have been able to do it with IF/ELSE statements and would like to do it using polymorhism so as to allow dynamic binding.Part of the code is shown below
I am open to any suggestions
private class commandhandler implements ActionListener
{ public void actionPerformed(ActionEvent event)
for(int start=0;start<end;start++)
{ String read=label2.getText();
COMMAND (OpCode,Operand);
}
}
public void COMMAND(String COM1,String COM2)
{ if(COM1.equals("01"))
{ String copy1=label.getText();
}
else if(opcode.equals("02"))
{
}

Topic: ResultSetMetadata.getTableName Previous Topic   Next Topic Topic: Adding to a Vector problem

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use