"interface" datatype variable??

While working with other people's Code I found the following:
<code>
public interface iMyClass //the interface
public static string str = "";
public void setStr(String sStr);
</code>
and in the same package:
<code>
public class MyClass //the class
private iMyClass kuku; //a variable whose datatype is an interface
private void setStr(iMyClass); //at the interface the param is a string
// and here an interface!?
</code>
Is this possible?
I have learned the following:
KEYWORD: interface
A class description which is unimplemented, used only to describe methods and fields
which can later be provided by other (not necessarily subclass) classes.
<br>
<b>
1.How it is possible to declare a variable whose datatype is interface??
2.why the datatype changes at function?
3.why at the class declaration doen't appears the word "implement"
</b>
<br>
Thanks in advance for any help/links.
Bentzy

OK Dorceon, you are right.
But I found the following:
<code>
public class VClass implements iMyClass
private iMyClass kuku;
</code>
just to use the static members of the interface in the class functions this way:
<code>
this.kuku.str = "example"
</code>
why to declare the variable kuku?
can't I reach the interface variables this way?:
this.str = "example"
THANKS!!!!!!!

Similar Messages

  • Interface member variable by defaultly static ?

    Hi,
    The interface member variable by defaulty public,static,final.
    But i have one doubt.
    It is public because it has to access out side the interface.
    It is final because the value never changes
    Why it should be static ???
    Thanks,
    Narendra babu.B

    Member variables are an implementation detail. Java does not allow multiple implementation inheritance. Java does allow multiple subtyping through interfaces. So interfaces can't have member variables.
    Consider the diamond of death:
    interface A
        int x;
    interface B extends A
    interface C extends A
    interface D extends B, C
    }See the problem now?

  • Web Interface Builder & Variable???

    Hi,
    Can someone help me to resolve this two issues.
    I try to create variables by using web interface builder.
    <b>1)</b>The variable- company code-<b>US100, CA100</b> are only ones I use in the selection of my planning leveL. <b>However, it shows all possible entries for the variable-company code</b> when I added the variable-company code in the web interface builder.
    <b>2)</b>Another variable-forecast year, I created it in the planning area (using 'fiscl year') and try to add this variable in the web interface builder and got <b>an error message-the selection to 0fisclyear is not 'restricted'.</b>
    Advices are appreciated.
    J.

    1) Set "Planning level" property of selector for you variable in web interface builder
    2) Restrict fiscal year

  • Interface with variables

    Hello all, I have a problem that has stumped even the smartest software engineer I know. Why does the following slice of code always print out "This does not work as expected". It seems to me that the 'int' inside of the interface is implecitly final, but the compiler should throw a compiler error if that were the case. When I use the debuger packaged with JBuilder 9 the value of the 'int' is 1 as it should be when it gets to the condition, but it still enters the conditions as if it were a 0. Thank you in advance for your help.
    public class instanceOfInterface {
    public static void main(String argc[]) {
    interfaceDef2 id = new interfaceDef2() {
    public int someInt = 1;
    if (id.someInt == 1) {
    System.out.println("This works properly.");
    else if (id.someInt == 0) {
    System.out.println("This does not work as expected.");
    interface interfaceDef2 {
    public int someInt = 0;
    }

    No. Try the example by defining a base class with a
    non static field, extending this class and referencing
    the field with a reference to the subclass. Then
    assign the subclass reference to a superclass variable
    and do the same. You will see the same difference you
    see in this example. E.g.:
    public class TestFieldOverride {
    public static void main(String[] args) {
    Bar b = new Bar();
    Foo f = new Foo();
    Bar bf = f;
    System.out.println("Bar i = " + b.i);
    System.out.println("Bar getI = " + b.getI());
    System.out.println("Foo i = " + f.i);
    System.out.println("Foo getI = " + f.getI());
    System.out.println("BarFoo i = " + bf.i);
    System.out.println("BarFoo getI = " +
    = " + bf.getI());
    System.exit(0);
    }Question, do you know why this is permitted? It seems to me that this behavior, if actually used in real code would quickly create a maintance nightmare. I don't think that you even need to setup a strawman argument of 'what if every class you create has an i variable to show that this could easily be very confusing to a programmer.
    My only guess is so that you can create a private version of a variable that has the same name as a parent classes variable in a subclass. Thus reducing the pressure to create unique and very long names for the programmer. But for public/protected/default access member variable names shouldn't be avaliable for subclasses to override. Course it would probably break code to change it now. So it probably won't happen.

  • User Interface with variables in BPS0

    Dear All,
    We are planning for selective retraction using user defined variables assigned at planning level.  It is working well in BPS0 transaction.
    But, we want to have a front end to be given to the user other than BPS0 tcode to execute this.
    We have tried to create Ztransaction by calling  SAP standard function module 'API_SEMBPS_FUNCTION_EXECUTE' in an executable program .  The pop-up window that comes for inputting variables in BPS0 doesn't come here.
    Also, please let me know if there is any other approach to give a user interface other than a Ztransaction code.
    Thanks in advance.
    Regards,
    Srini.

    hi,
    I have created a variant for my planning folder.
    In SE93, when I create a custom transaction, I have selected the option 'Transaction with Variant'.
    I have given the transaction code as UPSPM and for the variant  when I press F4, it gives 'No variants for this transaction'.
    Any views?
    Regards,
    Srini.

  • Interfaces: static variables but instance methods, why?

    Why do variables need to be static in interfaces but the methods in them are not allowed to be static? Or, asked differently: Why methods must not be static while variables have to be static in interfaces?
    I don't understand the reason for that difference.

    An interface defines functionality but can not be instantiated as an object. So for the static variables, it can define variables that can be accessed by all implementing classes, but there can only be one definition of them, hence static. Non-static variables fall in the realm of implementation, which is not what interfaces are for.
    Static methods are used to define an implementation that is common among all instances of an object, and must be implemented when defined. Since interfaces can not provide any implementation, static methods are invalid. Remember that static methods are commonly used without instantiating an object (like java.lang.Math methods) so the implementation must be provided when defined.

  • Set array instance to Interface datatype

    <prelude>This is an odd question with no real significance to me, other than pure interest...</prelude>
    Suppose the following...just for example
    Integer[] arrInteger = new Integer[5];I understand that the following is legal..
    Interface i = arrComp;...provided that the Interface is either Cloneable, or Serializable.
    Why is this legal....Are arrays always serializable as defined in the language spec...
    If arrays are Cloneable, shouldn't they override the method "clone" from the Object class..and how do they do that, there are no classes for arrays....Or maybe they just "do" as a feature of being an array...
    It just seems odd that it is possible to set an array, any array to a Cloneable or Serializable interface.

    I've done what I probably should have done before I posted, I've consulted the Java Language Specification ( http://java.sun.com/docs/books/jls/ )and there I've found my answer..
    From the section Conversion and Promotions....
    Assignment of a value of compile-time reference type S (source) to a variable of compile-time reference type T (target) is checked as follows:
    If S is an array type SC[], that is, any array of components of type SC:
    If T is an interface type, then a compile-time error occurs unless T is
    the type java.io.Serializable or the type Cloneable, the only interfaces implmented by arrays.
    So it looks like arrays implement these interfaces and that is why this assignment is legal. I just didn't realize that.

  • AS3.0 External Interface: Pass variables to flash using javascript

    Hello all,
    I am looking for a simple and straightfoward example of how I can pass the value of a variable into flash using javascript.
    Specifically, I'd like to use javascript to pass the filename of an external video file that I would like to load into my flash movie.
    I'd also like to call a function in the SWF that plays the movie once the filename as been passed to the flash movie.
    External Inferface looks like the way to go.
    I've found a few decent AS2.0 examples, but converting them to AS3.0 has proven difficult and many of the examples are much too complex for what I am trying to do.
    If you have any code samples or tutorials showing the HTML/Javascript and the associated actionscript I'd really appreciate it!
    Thanks!
    Tim

    if you create a swf (eiTest.swf) and html:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
        <head>
            <title>eiTest</title>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <script language="JavaScript">
             function thisMovie(movieName) {
             if (navigator.appName.indexOf("Microsoft") != -1) {
                 return window[movieName];
             } else {
                 return document[movieName];
         function f1(value) {
             thisMovie("eiTest").jsF(value);
    </script>
        </head>
             <body onload="f1('yourfilename.ext');">
         <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                 id="eiTest" width="550" height="400"
                 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
             <param name="movie" value="eiTest.swf" />
             <param name="quality" value="high" />
             <param name="bgcolor" value="#869ca7" />
             <param name="allowScriptAccess" value="sameDomain" />
             <embed src="eiTest.swf" quality="high" bgcolor="#869ca7"
                 width="550" height="400" name="eiTest" align="middle"
                 play="true" loop="false" quality="high" allowScriptAccess="sameDomain"
                 type="application/x-shockwave-flash"
                 pluginspage="http://www.macromedia.com/go/getflashplayer">
             </embed>
         </object>
        </body>
    </html>
    you can use:
    import flash.external.ExternalInterface;
    ExternalInterface.addCallback("jsF", asF);
    function asF(fileS:String):void{
    trace(fileS);

  • Problem  to Multiply the Values and Stored in the Same Datatype Variable.

    HI,
    my Variables are :
    data : lv_per    TYPE konv-kwert,
              lv_amt    TYPE KONV-KWERT,
             lv_cost    TYPE KONV-KWERT.
          LV_COST = 2073.00.
          LV_AMT   = 6000.00.
        I want to calculate as lv_per  = (LV_COST /  LV_AMT)  * 100.
        BUT Value coming as 0.00 in lv_per instead of coming correct result as 34.55.
    Kindly Help me on the same.

    Hello Mahender,
    This is definetly problem of fixed-point arithmetic check box. So in which ever main program you are going to include this you
    can set FPA check box in it's attribute screen.
    Thanks,
    Augustin.

  • SQL Server 2008 XML Datatype variable size limit

    Can you please let me know the size limit for XML Data type variable in SQL Server 2008?
    I have read some where that the XML data type holds up to 2GB size. But, its not the case.
    We have defined a variable with XML data type and assigning the value by using SELECT statement FOR XML AUTO with in CTE and assigning the outout of CTE to this XML type variable. 
    When we limit the rows to 64 which has a length of 43370(used cast(@XMLvariable AS varchar(max)), the variable returns the XML. However, if i increase the rows from 64 to 65 which is length of 44048, then the variable returns with Blank value.
    Is there any LENGTH limit of the XML data type?
    Thanks in advance!!

    Hello,
    See MSDN xml (Transact-SQL), the size limit is 2 GB and it is working. If your XML data will be truncated, then because you are doing something wrong; but without knowing table design
    (DDL) and your query it's difficult to give you further assistance; so please provide more details.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • The class or interface 'URL Variables' could not be loaded

    what should i do for this problem is my action scripts...
    my scripts is....
    import mx.transitions.Tween;
    import mx.transitions.Zoom.*;
    import caurina.transitions.*;
    import flash.net.URLRequest;
    import flash.net.URLVariables;
    var myGalleryXML = new XML();
    myGalleryXML.ignoreWhite = true;
    /*new*/
    var search = 'all';
    var filter = 'all';
    var search:String = ExternalInterface.call("window.location.search");
    var vars:URLVariables = new URLVariables(search);
    trace(vars.search);
    trace(vars.filter);
    if(vars.search!='all' and vars.filter!='all')
        search= vars.search;
        filter=vars.filter;
    myGalleryXML.load("http://supremeinv.in/demo/index.php/"+search+"/"+filter);

    First you need to decide which version of Actionscript you are going to use, then use the code that agrees with that decision.  URLVariables (and URLRequest) are AS3 code elements.
    Elsewhere, you will end up with conflicts if you continue to declare the same variable multiple times.  In this case you are declaring var search at least twice.

  • Container Variables Not Filled

    Hi,
    I have configured Alert Category and Alert Rules to trigger exceptions at Mapping, Adapter and Proxy level.  All these alerts are getting triggered properly.  But the container variable, &SXMS_FROM_SERVICE& is not getting populated and displays the tag as such.
    I infact checked the Note 947738 (Container Element not filled).  But this is for SP 09.  We are in Release 7.0 SP 11.  So the note is already implemented.
    But still I am facing this problem.  The container variables are not filled.  Can someone suggest how to fix this.
    Regards.
    Bala

    Hi,
    Are all the other Container Variables being populated?
    If yes, one option is to check note : 913858 . This note describes one question when the From Interface Container variable does not fill up. Check what it mentions.
    Regards
    Bhavesh

  • Passing variable value as a prompt

    Hi All,
    I have one problem related to passing variable through prompt. let's discuss whole situation. Suppose I have 5 interface having variable say user_id in each interface. And 5 packages for each interface. Now I have generated scenario for these packages. I am using these scenario to create one master package. Also I have created scenario for master package. Now I want to do something like this. When I execute scenario of this master package there should be one prompt asking value for user_Id value and that value should pass to all packages and interface and same value should be inserted in target table. I can bring prompt but can not insert that value in database.
    Request you to help me out in this case.
    Thanks and Regards
    -Pallav

    Hi Pallav,
    Not sure how are you trying to insert the variable value in the database but you can create an ODI variable to capture the user entered data from the scenario UI and you can pass the same variable to the underlined package/interfaces.
    Could you elaborate a bit more on the inserting the variable value in the database.
    Thanks

  • Interface inconsistency

    Hi All,
    I was just trying to fix the way the compiler does with the code below. Please have a look at this and let me know how '20' is printed on running it...
    It might look weird but, I tried this to understand the way the interface is compiled.
    Any explanation will be highly appreciated.
    interface inter
    int j = interinter.i + 10;
    interface interinter{
         int i = j + 10;
         int method();
    public class checkFloat implements inter{
    public static void main(String [] args){
         System.out.println("Inter " + inter.j);     
    *************************************************************

    This sounds theoritically perfect.
    As u know,
    1) The interface member variables are not initialized by default. i.e. Java compiler would not let you go with uninitialized variables. The value of x in ur ex., should not be given a 0.
    2) In my code, if I print interinter.inter.i the value is the same. i.e it prints 20.
    3) What surprise me is that...
    a) Is the nested interface loaded first or the outer interface loaded firstr

  • Regarding interface in the ABAP-HR

    Hi Experts,
             Iam new to ABAP-HR,
             I have 2 custom table which are updated with OT records from one batch program.
             Now i have to generate two files for regular OT data file and Off-Cycle OT data file respectually.
    What i have to do?For this i have to  pick the data from those two custom tables and create the files by using open dataset statement,Is this right way in HR?
    Actually the selection screen is having Payroll area,Current period and Other period fields.
    and the table is having BEGDA,ENDDA in one table and OTdate in onother table.How can i compare the dates?

    Hi,
    <b>Interface</b> Can be declared globally or locally within a program.
    Locally declared in the global portion of a program using:-
    INTERFACE <intf>.
    ENDINTERFACE.
    The definition contains the declaration for all components (attributes, methods, events) of the interface.
    Interfaces are included in the public section of a class.
    Interfaces do not have an implementation part, since their methods are implemented in the class that implements the interface.
    Interfaces do not have instances.
    A component <icomp> of an interface <intf> can be addressed as though it were a member of the class under the name <intf~icomp>.
    <b>Addressing Objects Using the class reference variable <cref>:</b>
    To access an attribute <attr>: <cref>-><intf~attr>
    To call a method <meth>:
    CALL METHOD <cref>-><intf~meth>
    <b>Using the interface reference variable <iref>:</b>
    To access an attribute <attr>: < iref>-><attr>
    To call a method <meth>:
    CALL METHOD <iref>-><meth>
    Addressing a constant <const>:
    <intf>=><const> (Cannot use class name).
    Addressing a static attribute <attr>:
    < class>=><intf~attr>
    Calling a static method <meth>:
    CALL METHOD <class>=><intf~meth>
        (Cannot use Interface method ).
    casting operator (?= )
    <cref> ?= <iref>
         For the casting to be successful, the object to which <iref> points must be an object of the same class as the type of the class variable <cref>.
    <b>sample program</b>
    report ysubdel .
    interface i1.
    data    : num type i .
    methods : meth1.
    endinterface.
    class c1 definition.
      public section.
      methods : meth1.
      interfaces : i1.
    endclass.
    class c1 implementation.
      method : meth1.
       write:/5 'I am meth1 in c1'.
      endmethod.
      method i1~meth1.
       write:/5 'I am meth1 from i1'.
      endmethod.
    endclass.
    start-of-selection.
      data : oref type ref to c1.  create object oref.
      write:/5 oref->i1~num.
      call method oref->meth1.
      call method oref->i1~meth1.
    Regards,
    Sowjanya.

Maybe you are looking for

  • Prompt in PL/SQL block

    Hi, I want to prompt procedure name and it's version during execution of procedure...? I am new in PL/SQL part, not sure whether it's possible or not? dbms_output.put_line gives output after execution and after setting serveroutput 'ON'.. Is there an

  • Data Object

    Hello All iam new to BAM and BPEL. our requirement is to see the monitor BPEL process acitvity using BAM. Java team had developed an BPEL application and in which they also developed sensors and deployed. When i am connecting thru BAM iam able to see

  • Question Keyboard Design on Passport

    Just curious why the drastic keyboard design limitation on the new BB Passport.  I really like the looks of the phone, but am stumpt at why the missing functionality on the hard key - keyboard.  I cannot speak for everyone else, but my loyalty to Bla

  • Problems mounting a Transcend StoreJet OTG 30GB on OS 10.5.5

    Hi I cannot make my Macbook Pro recognize my USB StoreJet at all. I have tried all USB ports and also with and without the power for the StoreJet attached. Zero response from my Mac? I have experienced absolutely no problems before with other USB dev

  • Problem with playback in Audition CC

    Hello everyone, im new here and work with Audition CC at the moment.. now i went into an error or problem that i dont know how to solve. Simple as that i have a laptop with a Realtek HD Audio Soundcard and want to play many clips in a multitrack in A