Why we use Interface?
hai
Can i have a explanation for using Interface (apart from overcoming multiple Inheritance)
**ACK. Got method names mixed up. Though it doesn't really matter, here is the correct mapping from the original reply, to avoid confusion.** :)
This is wrong. You can't have an instance of an interface as you have declared here by saying Draggable drag. Interfaces cannot be instantiated. I think what you meant to say is this:
//understand this is blatantly skeletal
class ConcreteDraggable implements Draggable {
//these methods must be defined, even if the definition is merely {}
dragTo(...) {...}
calcDistance(...) {...}
}And then in the script that uses ConcreteDraggable:
ConcreteDraggable dragThis = new ConcreteDraggable();
dragThis.dragTo(...);
dragThis.calcDistance(...);
Similar Messages
-
Why to use Interface if methods are not implemented??
Hello,
I am having a problem to clearify as, why to use the interfaces which defines only methods and no implementation??
When a class implements an interface the methods are implemented by the class itself, don't you think that the same functionality can be achieved if the class defined the method itself...
The why to use interfaces, just that the same method name can be used by many classes or some other reasons..did you google on that? There is lots of information I am sure explaining why you code to an interface defined type rather than a class defined type.
However, fundamentally you are correct, classes define their own type. The idea is that you use an interface because it allows you to have more than one implementation. Plus you can more easily change the structure of your program if you later wish if you did not use the class type directly.
You get better answers if you ask in the Patterns forum below. -
Why not use interfaces for constants?
Hi,
I have been getting conflicting views about why not use interfaces for constants?
Can anyone shed some light on it?
PiyushHow so?
If the constants are only used in a single classhow
does it help to put them in a separate structute?
(Ignoring the a type safe enumeration of course.)Well, mainly for readability. Suppose that you have a
web application which has a servlet class
"RedirectServlet", which takes a variable to redirect
to a given JSP file. In the JSP files, you want to
create forms which take this servlet as their action.
You could of course put all these "redirect"
constants in the RedirectServlet itself, but then
it's kind of weird that you have to import a
servlet in your jsp file to include these constants
and to be able to write
<form action="servlet/RedirectServlet?key=<%=
RedirectServlet.HOMEPAGE %>> or so.
Instead, you could create an interface called
"RedirectConstants", and then your servlet
RedirectServlet could implement this interface. Then
your JSP can also access these constants via this
interface.
But then again, this is merely a matter of style, I
fully agree that there is never a real _need_ to put
constants in a separate structure if they're only used
in a single class.Are you claiming that your example above is a single class? -
hi all!
i m confused that what is the advantage of using interfaces for classes if it is for security,data hiding pupose then we can use private modifiers,then y is this think built in java and which r the cases in which we must use interfaces and y?
plz give me any simple example to understand ur point
thanx in advance.
sajjad ahmadHmm... First, I'm sorry about my English... but i will try.
In C++ we can use multi-inheritance that let the developer "extends" one or more classes.
eg.
class Hello extends A,B,C,D
This case can be happened in C++.
But If both class A and B have a method call "void sayMyName()"
How can we refer which method was called when we call "Hello.sayMyName()"
A.sayMyName() or B.sayMyName()
So java don't allow this thing happen.
Java allow developers to extend "only one class"
but to enable multi-inheritance ability Java allow developer to implement more than one class.
That is "interface" which was implemented.
Now lets talk about it's benefits.
Interface is not for security or data hiding purpose.
But interface is used for "make a template".
When I created one class called Hello.
But I have created another class too.
Now I want to make sure that my classed have a method "void say()"
What can I do ?
1. Make some class that have a method "void say()" and let my classes extend it.
2. Make an interface and implement it.
Choise number one is quite good ... but !!!
If I have to extend some another class that is more important such as "Applet"
Now I can't extend another class.
I need only method "void say()". But I don't care what it does.
So I make an interface that force the implementing class to create a method "void say()"
and I implement it.
Question: Why I have to implement this interface ? If I only define a method "void say()"
The problems is gone ....
Answer: That may be true if I want them to have a method. But how can I refer to them.
Lets see this code.
class A extends Applet {
void say() {System.out.println("My name is A");}
... go on ...
class B extends Applet {
void say() {System.out.println("My name is B")}
... go on ...
class GO {
public void letMeSay(............. o) {
o.say();
What can I fill in the argument of method "letMeSay()"?
Object ? Object doesn't have a method "void say()"
Applet ? With the same reason.
Now lets see another code.
interface Sayable {
abstract void say();
class A extends Applet implements Sayable {
void say() {System.out.println("My name is A");}
... go on ...
class B extends Applet implements Sayable {
void say() {System.out.println("My name is B")}
... go on ...
public void letMeSay(Sayable o) {
o.say();
It's ok right ... I can refer to interface "Sayable" that can "say"
Next benefit of interface ... "define Constants field"
We can define constants in an interface and implements it to everywhere we want to use those constants. When we change a value in this interface ... Constants in another place will be changed too .... that is very useful ....(But this may have change in J2SE 1.5 ... see more info)
"I HOPE THIS REPLY MAY GIVE YOU SOME KNOWLEDGE ... GOOD LUCK WITH PROGRAMMING" -
My question is : Why we use Interface?There is all most same class & interface.at the 1st time we declare method or variables in the interface.2nd time we also declare them when we implements.So i am not clear why i use interface
Hello,
When you write an interface I, you can write methods in other classes with I en parameter without knowing what the object is.
When you write this method, you are sure that these methods exist in the object.
An interface is a behaviour.
You can use many very different objects which have the same behaviour :)
example:
public interface Moveable
void move();
public class StupidMan
public void kick(Moveable m)
m.move(); // The object m can be moved, but that's just you know
public void mouse implements Moveable
public void car implements Moveable
public void table implements Moveable
public void computer implements Moveable -
Import invoices using interface table
Dear all ,
I want to import invoice from legacy system to oracle EBS R12 , and i use interface table to import the invoice.
The problem is when i run Payable open interface import concurrent program to import the invoices , it didn't import any invoices
and the report output didn't show any error or any data according to the invoices.
Report output :
Report Date: 27-JUN-2010 11:25
Page: 1
Payables Open Interface Import Report
Hold Name:
Source Name: Manual Invoice Entry Hold Reason:
Group: GL Date:
Purge: No
Summarize Report N
Report Date: 27-JUN-2010 11:25
Page: 2
Payables Open Interface Import Report
Hold Name:
Source Name: Manual Invoice Entry Hold Reason:
Group: GL Date:
Purge: No
Summarize Report N
So i go to the db and open the interface table and the status was null ,
i dont know why????????Hi ,
100% org_id problem Please check. Same i faced after i update the org_id it is working fine and showing the output with inovice and rejection details also
Thanks
Venkat -
. Why we use Sync-Async bridge? .
Why we use Sync-Async bridge?
Dear Manoj,
http://help.sap.com/saphelp_nw04/helpdata/en/55/c5633c3a892251e10000000a114084/content.htm
A distinction is made between synchronous and asynchronous communication for both imported interfaces and message interfaces. You define the mode of communication when you define an interface:
· In the case of synchronous communication, a response message is expected from the receiver after a request has been sent. Once the request message has been sent, no further messages can be sent until the response to the request has arrived back at the sender system.
· However, in asynchronous communication a (immediate) response is not expected. A sending process can send multiple messages to a receiver in a bundle and then continue executing the process.
You would use Synch - Asynch Bridge to enable the communication between a synchronously calling business system (synchronous outbound interface) and an asynchronously called business system (asynchronous inbound and outbound interface), you can define a sync/async bridge in an integration process. You can only define one sync/async bridge for each integration process.
Regards,
Naveen. -
Why we use Tables statement in case of using SELECT-OPTIONS:
hi all,
Why we use Tables statement in case of using the following coding in an ABAP program ...
tables: vbak.
SELECT-OPTIONS: s1 for vbak-vbeln.
here if we dont provide the tables statement why it does not work ????
pls answwer ....???Hi
This statement is not allowed in classes and declares a data object table_wa as a table work area whose data type is adopted from the identically named structured data type table_wa from the ABAP Dictionary. table_wa must be defined as a flat structure in the ABAP Dictionary. You can specify database tables or Views for table_wa.
Work table areas declared with TABLES are interface work areas and should only be declared in the global declaration section of a program for the following purpose:
reward if usefull
The statement TABLES is required for exchanging data between screen fields that were defined in a program screen when transferring from the ABAP Dictionary and the ABAP program. For the screen event PBO, the content of the table work area is transferred to identically named screen fields; for PAI, the system adopts the data from identically named screen fields.
In executable programs, flat table work areas can be used for adopting data that were provided for the event GET table_wa from a linked logical database. TABLES is synonymous with the statement NODES for this purpose.
Work table areas declared with TABLES behave like the data declared with the addition COMMON PART, meaning the data are used by the programs of a program group.
Table work areas declared with TABLES can be declared in subroutines and
function modules. However, this is not recommended. A table work area declared in a procedure is not local but belongs to the context of a framework program. The table work area can be viewed starting from the declaration in the framework program and lives as long as the framework program. In contrast to normal program-global data, the content of the table work areas declared in subroutines and function modules is stored temporarily when these subroutines and function modules are called. Value assignments that were made during runtime of the procedure are preserved until the procedure is completed. When exiting the procedure, the table work areas are filled with the contents that they contained when the procedure was called. Table work areas declared in procedures behave like global data to which the statement LOCAL is applied in the procedure.
The form TABLES * is obsolete. -
Why to use the Java API in MDM
Hi Experts,
I am new to the MDM.
We are having the requirement of inetration between Portal and MDM.Can u please tell me when to use the following coponents like the scenorio's.
Why to install the MDM Business packages in Portal?
why to use the JAVA API.
Please give me the complete information.
RegardsHi Vijay,
Standard Business Package is use to provide interaction between MDM Server and the Portal. It consists of MDM iViews like Item Detail iView (allows to create,edit and delete the records) , Resultset iView (Displays the records, allows to add the records in workflows etc), Search iViews (for searching)i.e. Data Manager functionality.
Java API are used when you need some functionality that standard MDM iViews dont have.MDM Java API consists of set of classes and interfaces with the help of which customization can be done.
Regards,
Jitesh Talreja -
Why to use htmlb elements in bsp applications
Hi All,
I have a doubt that why to use htmlb elements for implementing user interface in bsp applications .Implementing bsp application using htmlb is difficult than html because we have handle event triggering in oninputprocessing but this is not required in html.Can anybody help me out in understanding the advantages of htmlb over html.
Thanks in Advance......Dear Srilalitha
Re: Why htmlb is prefered to normal html code ?
Please go thorught this. This will surely help.
Regards
Vijay.M -
What is the advantages of using Interface?
Hi,
I still don't get what's the advantages of using interface. Reusability? is it the main advantage? thanks in advance.What is GOF?
Interface is a good program practice when working with RMI (Remote Method Invocation) application. Imagine your anti-virus. When you connect to internet your software invoke a method into your software vendor site and download the new definitions. Now every anti-virus Subscription is different. The method you invoke, will depends on your Subscription. If you hard code the method abstractly, you will not achieve this functionality.
Another concept is that because Java does not practice multile inheritance interface is a goog way to interface into another class.
Example
I want to extends to multiple class which java do not support. I will write an interface i.e I want to extends to FileOutputStream, OutputStream, Object, Integer, String, ActionEvent, Window etc.
I will write an interface like this
interface MyClass {
pulic void setFileOutputStream ( FileOutputStream file );
public void setOutputStream ( OutputStream );
public Object getObject ( );
public Seriable getInterget ( )
------------------- //You get the gist
With this interface you can implement they behaviours
You could say, why don't we just import them. When yo import them you have already hard coded there behaviour. But this way you can apply diferent behaviour throughout you application development. And any class that implement them must provide ways of using it. -
Why we use IDOC adapter for IDOC as reciever?
hello,
Why we use IDOC adapter while using IDOC as receiver, whereas we don't use IDOC adapter while IDOC is sender?
I am clear about why we don't use adapter for sender IDOCs.
Thank you.
SarikaHi Sarika,
>>>>Why we use IDOC adapter while using IDOC as receiver,
maybe the easiest answer would be that we use
IDOC adapter as receiver to tell the XI where he should
send the data - there are many systems to which we can
connect our XI and somewhere there has to be an object
which will tell thx XI "where to" -> which RFC destination should it use
BTW
I believe IDOC apdater is also used as sender
although you don't configure it in AF:
"Once the IDoc has left the application through the RFC interface and has reached the <b>IDoc adapter</b> at the Integration Server inbound channel, the system converts it from IDoc format to IDoc XML format"
from:
http://help.sap.com/saphelp_nw04/helpdata/en/b9/c5b13bbeb0cb37e10000000a11402f/content.htm
Regards,
michal -
why to use beans?
One) I think you need to read up on the bean specification and examine the API before you can expect someone to help you understand it.
Two) Java beans are still java classes. There are special interfaces and classes which can be used to better aid visual tools or any other tool actually that may use beans, but they are not required to be created for any given bean. I think the notion that "beans" add over head is simply invalid as a bean can be as simple as a class that has a property name and has methods public void setName(String) and public String getName(). The only thing that makes this a bean is naming conventions. There are helper classes that pick out these patterns for IDE's to make it easier for them or any other bean friendly environment to access classes designed a special way (those that adhere to the bean standards/patterns). So, other than some special property customizer gui's and other helper classes that are not required to be used, if you know how to use setter and getter methods you know how to create at least simple beans, and bean friendly environments can more easily use your class because they can detect the bean patterns and at least know how to make your class/bean available and useable in their context. That's the biggest advantage...a standardized approach to a certain portion of the design that allows applications to access generic components in a usual/logical/standard fashion.
Wade -
Why we use function module SSF_FUNCTION_MODULE_NAME in smartform driver program?
Forum Search
Use the form below to search the forum content. You can choose to search all content or restrict it to certain forums or dates. Also, you can filter the results by a username or user ID.
Search Forum Content
Search Terms: Search Tips
Category or Forum:
Date Range:
Results Per Page:
Welcome, Clemens Li Help
Your Control Panel Your Control Panel
Your Reward Points Your Reward Points
Your Questions Your Questions
Search Results » Messages: 271 - Search Terms: why we require form interface section in smartform? Sort by:
Pages: 19 1 2 3 4 5 6 7 8 9 10
1. Why we require FORM INTERFACE section in smartform?
Posted on: Sep 12, 2007 10:47 PM, by user: p d -- Relevance: 100% -- Show all results within this thread
Why we require FORM INTERFACE section in smartform?
2. What is the driver program & why we require driver program?
Posted on: Sep 12, 2007 10:48 PM, by user: p d -- Relevance: 17% -- Show all results within this thread
What is the driver program & why we require driver program?
3. Re: form interface in smartform
Posted on: Feb 21, 2006 11:51 AM, by user: Hasmath -- Relevance: 14% -- Show all results within this thread
hard-coded driver program in the tables section. for this u have to define the same structure in the form interface of the smartforms and can use the same structure for sending the data to the smartform ...
4. Smartform: Form Interface
Posted on: Aug 24, 2007 2:34 PM, by user: vivek pandey -- Relevance: 13% -- Show all results within this thread
Hi, If we want to use a workarea/internaltable in the form interface of Smartform of a user defined structure ...
5. Form Interface in Smartforms ?
Posted on: Oct 27, 2006 5:32 PM, by user: SAP BEE -- Relevance: 12% -- Show all results within this thread
ztest ) on the table and print the value : &gs_vbap-total&. I activate the form ...it is fine ...as well as program !! Now , when i do the print preview of the form , It gives an error : Reference ...
6. SmartForms form interface - tables
Posted on: May 18, 2005 2:44 PM, by user: Diliip Gupchup -- Relevance: 12% -- Show all results within this thread
Hi All, In smart forms how to declare our internal table in form interface? By using types in global itried but it is ...
7. Calling thru Form Interface of Smartforms
Posted on: May 4, 2007 3:03 AM, by user: Subhasish Ganguly -- Relevance: 11% -- Show all results within this thread
In a Smartforms, how can I call a internal table thru 'Form interface' which has been declared in the driver program? ...
8. Form Interface in SMARTFORMS
Posted on: Jun 1, 2006 10:56 AM, by user: Rams V -- Relevance: 11% -- Show all results within this thread
Hi There, Is it mandatory to create a custom structure in ABAP dictionary to use it in SMARTFORM interface? regards, Rams. ...
9. Line Types and Table types & Smartform form interface
Posted on: Sep 21, 2005 3:38 PM, by user: Aadarsh K -- Relevance: 10% -- Show all results within this thread
types ?? 2. In smartforms form interface, in the importing parameter, can tables be passed ?? [we use tables parameter generally, but even if passed in export parameter, no error is being given and ...
10. regarding complex section in smartforms
Posted on: Aug 25, 2007 7:49 AM, by user: ravi -- Relevance: 10% -- Show all results within this thread
learning smartforms on 5.0ecc and i got the documents which is showing the complex section but in 5.0 ecc we have no complex section cud u plz let me know where sud i add the contents of the complex section ...
11. why is it that some function module require an endselect
Posted on: Aug 8, 2007 3:40 PM, by user: mathias Mbizvo -- Relevance: 10% -- Show all results within this thread
why is it that some function module require an endselect and some can work without the endselect...
12. Complex section in smartforms
Posted on: Aug 11, 2007 7:29 PM, by user: narendra veduru -- Relevance: 9% -- Show all results within this thread
Hi I am practicing smartforms in 4.7. I have a tutorial based on 4.6c and they have complex section in the nodes. How do i ...
13. form interface using currency fields - smartforms urgent!!!!
Posted on: Aug 17, 2005 1:11 AM, by user: skmysore -- Relevance: 9% -- Show all results within this thread
called function module. what is the error here? How can i correct this to display data into the form? Please help me it is urgent!!! Thanks Santhosh ...
14. why do we activate a program
Posted on: Feb 28, 2007 5:50 AM, by user: Rose -- Relevance: 8% -- Show all results within this thread
hi, why do we activate a program or tables in sap.Though there is a option known as save why do we activate? ...
15. Re: what is form interface and global definitions
Posted on: Jun 5, 2007 8:25 AM, by user: Venkatesh -- Relevance: 8% -- Show all results within this thread
Function modules. and global definitions are the variable or tables declared with in the smartform. we can pass values to the smartform from the driver programme through the form interface. if helpful ...
Pages: 19 [ 1 2 3 4 5 6 7 8 9 10 | Next -
Loading dimensions using interface table
Hello,
I am trying to load dimensions into EPMA 11.1.1.3 using interface tables and need some direction. I have an accounts dimension file with the following columns ( Parent, Child, Alias, Description, DataType,Aggregation). I configured a data source using configuration wizard (Interface tables).
I see in the database that some sample tables are created. Now, should I create a separate table with the columns listed above?
Can someone let me know what are the next steps to successfully import accounts dimension?
ThanksCan someone plz respond?
This is important for me. I have gone thru' the documentation and also the sample tables but don't understand why are there multiple tables for a particular dimension viz. hierarchy, property etc?
Please tell me the right way.
Thanks again!!
Maybe you are looking for
-
Pages always opens in a super wide window with extra columns
I work with simple spreadsheets, often with just two or three columns, and usually with just one table that fits easily on a single page. In spite of this, when I open files the opened windows are much wider that they were when saved and have additio
-
Hello, Im using LV7.1 with NI-Daq 7.4. in my Application i use multiple tasks, a few for aquiring analog and digital input from my first 6024E and one to aquire digital input from my second 6024E. In most of the time this works very well, but from ti
-
Hi Experts Iam working on implementation project, here already some cube are there is a sales, financials & Material Movements cube. Here Sales and financial cubes are customer define means start with u2018Zu2019. Here my doubt is how to know the fac
-
Deadline Message in the workitem
Dear Friends, I want to change the message which comes in the workitem when the deadline is missed. This message move from one end to another end automatically and display only when you single click on the worktitem, " The following deadline was miss
-
2.4ghz Macbook pro battery issues
3 days ago my battery began acting strange. I did not 'upgrade' to Snow Leopard, but at 100 cycles, I'm getting 'Check Battery' status, and a Full charge capacity that will range from 2800-3880,( at one point, for about an hour it read 4800 with a "G