Flaw in interface declaration

Hi,
While writing a code , i mistakenly compiled the following code with interface declared as :
interface A extends r
where r was not declared anywhere
Anyone can please suggest why this happened. Is this a flaw in JAVA.
Thanks
Deepak

Either you'd mistakenly created a class called "r" earlier, or you were mistaken in thinking that it compiled. Given your apparent predeliction for single letter class names the former seems the most likely.

Similar Messages

  • Syntax Error In Interface Declaration

    Hi,
    while activating proxy i am facing "Syntax Error In Interface Declaration" Error. pls guide me to rectify it.
    Thanks in Advance.
    Regards,
    Chandra

    Hi ,
    XML message interface
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:p1="http://MYTUTORIAL_CM" name="FlightSeatAvailabilityQuery_Out" targetNamespace="http://MYTUTORIAL_CM">
         <wsdl:documentation>
         Flight seat availability query - Out (only for use in XI Demo)
         </wsdl:documentation>
         <wsdl:types>
              <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://MYTUTORIAL_CM" targetNamespace="http://MYTUTORIAL_CM">
                   <xsd:element name="FlightNotFound">
                        <xsd:complexType>
                             <xsd:sequence>
                                  <xsd:element name="standard" type="ExchangeFaultData" />
                             </xsd:sequence>
                        </xsd:complexType>
                   </xsd:element>
                   <xsd:element name="FlightSeatAvailabilityQuery" type="FlightSeatAvailabilityQuery" />
                   <xsd:element name="FlightSeatAvailabilityResponse" type="FlightSeatAvailabilityResponse" />
                   <xsd:complexType name="FlightSeatAvailabilityQuery">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             47ad89c013b311dab948000d604e4c90
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:sequence>
                             <xsd:element name="FlightID" type="FlightID">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       011d0310139e11da948ef4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Flight ID
                                       </xsd:documentation>
                                  </xsd:annotation>
                             </xsd:element>
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="ExchangeLogData">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             47a65dd013b311dace53000d604e4c90
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:sequence>
                             <xsd:element name="severity" type="xsd:string" minOccurs="0" />
                             <xsd:element name="text" type="xsd:string" />
                             <xsd:element name="url" type="xsd:string" minOccurs="0" />
                             <xsd:element name="id" type="xsd:string" minOccurs="0" />
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="FlightSeatAvailabilityResponse">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             47b970a013b311da8619000d604e4c90
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:sequence>
                             <xsd:element name="EconomyMaxSeats" type="xsd:int">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       0b75900013a011daaf1ff4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Maximal Seats Economy Class
                                       </xsd:documentation>
                                  </xsd:annotation>
                             </xsd:element>
                             <xsd:element name="EconomyFreeSeats" type="xsd:int">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       0b75900113a011dac95cf4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Free Seats Economy Class
                                       </xsd:documentation>
                                  </xsd:annotation>
                             </xsd:element>
                             <xsd:element name="BusinessMaxSeats" type="xsd:int">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       0b75900213a011dacefcf4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Maximal Seats Business Class
                                       </xsd:documentation>
                                  </xsd:annotation>
                             </xsd:element>
                             <xsd:element name="BusinessFreeSeats" type="xsd:int">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       0b75900313a011dacc26f4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Free Seats Business Class
                                       </xsd:documentation>
                                  </xsd:annotation>
                             </xsd:element>
                             <xsd:element name="FirstMaxSetas" type="xsd:int">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       0b75900413a011da8918f4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Maximal Seats First Class
                                       </xsd:documentation>
                                  </xsd:annotation>
                             </xsd:element>
                             <xsd:element name="FirstFreeSeats" type="xsd:int">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       0b75900513a011da9d26f4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Free Seats First Class
                                       </xsd:documentation>
                                  </xsd:annotation>
                             </xsd:element>
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="FlightID">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             47b26bc013b311da99e3000d604e4c90
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:sequence>
                             <xsd:element name="AirlineID">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       a099b780139e11da9a55f4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Airline ID
                                       </xsd:documentation>
                                  </xsd:annotation>
                                  <xsd:simpleType>
                                       <xsd:restriction base="xsd:string">
                                            <xsd:maxLength value="3" />
                                       </xsd:restriction>
                                  </xsd:simpleType>
                             </xsd:element>
                             <xsd:element name="ConnectionID">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       a099b781139e11da830bf4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Connection ID
                                       </xsd:documentation>
                                  </xsd:annotation>
                                  <xsd:simpleType>
                                       <xsd:restriction base="xsd:string">
                                            <xsd:length value="4" />
                                            <xsd:pattern value="\d+" />
                                       </xsd:restriction>
                                  </xsd:simpleType>
                             </xsd:element>
                             <xsd:element name="FlightDate" type="xsd:date">
                                  <xsd:annotation>
                                       <xsd:appinfo source="http://sap.com/xi/TextID">
                                       a099b782139e11dac6c0f4d509b6dddf
                                       </xsd:appinfo>
                                       <xsd:documentation xml:lang="EN">
                                       Flight Date
                                       </xsd:documentation>
                                  </xsd:annotation>
                             </xsd:element>
                        </xsd:sequence>
                   </xsd:complexType>
                   <xsd:complexType name="ExchangeFaultData">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             47a1a2e013b311da8347000d604e4c90
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:sequence>
                             <xsd:element name="faultText" type="xsd:string" />
                             <xsd:element name="faultUrl" type="xsd:string" minOccurs="0" />
                             <xsd:element name="faultDetail" type="ExchangeLogData" minOccurs="0" maxOccurs="unbounded" />
                        </xsd:sequence>
                   </xsd:complexType>
              </xsd:schema>
         </wsdl:types>
         <wsdl:message name="FlightSeatAvailabilityResponse">
              <wsdl:documentation>
              Flight seat availability response (only for use in XI Demo)
              </wsdl:documentation>
              <wsdl:part name="FlightSeatAvailabilityResponse" element="p1:FlightSeatAvailabilityResponse" />
         </wsdl:message>
         <wsdl:message name="FlightSeatAvailabilityQuery">
              <wsdl:documentation>
              Flight seat availability query (only for use in XI Demo)
              </wsdl:documentation>
              <wsdl:part name="FlightSeatAvailabilityQuery" element="p1:FlightSeatAvailabilityQuery" />
         </wsdl:message>
         <wsdl:message name="FlightNotFound">
              <wsdl:documentation>
              Flight not found (only for use in XI Demo)
              </wsdl:documentation>
              <wsdl:part name="FlightNotFound" element="p1:FlightNotFound" />
         </wsdl:message>
         <wsdl:portType name="FlightSeatAvailabilityQuery_Out">
              <wsdl:operation name="FlightSeatAvailabilityQuery_Out">
                   <wsdl:output message="p1:FlightSeatAvailabilityQuery" />
                   <wsdl:input message="p1:FlightSeatAvailabilityResponse" />
                   <wsdl:fault name="FlightNotFound" message="p1:FlightNotFound" />
              </wsdl:operation>
         </wsdl:portType>
         <ifr:properties xmlns:ifr="urn:com-sap:ifr:v2:wsdl">
              <ifr:category>
              ifmmessif
              </ifr:category>
              <ifr:methods>
                   <ifr:method name="FlightSeatAvailabilityQuery_Out">
                        <ifr:isSynchron>
                        true
                        </ifr:isSynchron>
                        <ifr:isInbound>
                        false
                        </ifr:isInbound>
                        <ifr:interfaceCategory>
                        outbound
                        </ifr:interfaceCategory>
                   </ifr:method>
              </ifr:methods>
              <ifr:messages>
                   <ifr:message name="FlightSeatAvailabilityResponse">
                        <ifr:messType>
                        ifmmessage
                        </ifr:messType>
                        <ifr:technicalNamespace>
                        http://MYTUTORIAL_CM
                        </ifr:technicalNamespace>
                   </ifr:message>
                   <ifr:message name="FlightSeatAvailabilityQuery">
                        <ifr:messType>
                        ifmmessage
                        </ifr:messType>
                        <ifr:technicalNamespace>
                        http://MYTUTORIAL_CM
                        </ifr:technicalNamespace>
                   </ifr:message>
                   <ifr:message name="FlightNotFound">
                        <ifr:messType>
                        ifmfaultm
                        </ifr:messType>
                        <ifr:technicalNamespace>
                        http://MYTUTORIAL_CM
                        </ifr:technicalNamespace>
                   </ifr:message>
              </ifr:messages>
         </ifr:properties>
    </wsdl:definitions>
    Regards,
    Chandra

  • Static interface Vs Static nested interface declaration

    Hi,
    I have observed that static interface declaration is not allowed in Java. However static nested interface declaration is allowed.
    I could not understood reason behind this behavior.
    e.g.
    interface A{
         void AA();
         public static abstract interface Aa{
    } ........... this is allowed in Java.
    static interface d{
    } ...... This is not allowed in Java...
    I already know that static mean one for class and interface has only abstract method.
    Please let me know if any one know resign behind this.
    Thanks .

    Why don't you go to a Java forum?

  • Interfaces declare methods that one or more classes may or may not implemen

    Interfaces declare methods that one or more classes may or may not implement.
    true or false?

    Encephalopathic wrote:
    If you want to appear to be more than just someone scrounging for someone else to do their homeworkHe/she is what they is
    [http://forum.java.sun.com/thread.jspa?threadID=5292343]
    [http://forum.java.sun.com/thread.jspa?threadID=5283461]
    [http://forum.java.sun.com/thread.jspa?threadID=5283412]
    [http://forum.java.sun.com/thread.jspa?threadID=5279385]

  • Dynamic interface declaration

    Hello,
    Is it possible to have a dynamic interface declaration like you can have a dynamic object declaration?
    For an object:
    data: lo_object type ref to object.
    create object lo_object type (lv_object_name).
    Is this in some way possible to do with an interface? I need to do this for an interface at runtime.
    Gr,
    Jaron

    You can create data of a dynamically given reference  type (which may be an interface) and move the object reference to it.
    Something like so:
    DATA:
          my_obj TYPE REF TO object,
          lr_data TYPE REF TO data.
      FIELD-SYMBOLS: <fs> TYPE ANY.
      CREATE OBJECT my_obj TYPE my_object_type.
    TRY.
      CREATE DATA lr_data TYPE REF TO (some_interface_type_name).
      ASSIGN lr_data->* TO <fs>.
       <fs> ?= my_obj.
      CATCH cx_sy_move_cast_error.
      CATCH cx_sy_create_data_error.
    ENDTRY.
    Basically, the assignment tests if my_obj is an instance of the type named some_interface_type_name.
    Hope this helps,
    Sebastian

  • Runnable interface declaration

    Hello,
    Although the function run() is inside the public interface Runnable. its once again declared as abstract. Can i get to know the reason for this ?
    Thanks in advance.

    Abstract and public have nothing to do with each other.
    Every method in every interface is implicitly public and abstract. They can be declared that way or not, but if they are, it's redundant. Some programmers might choose to explicitly declare them public and/or abstract to make it obvious, but it's not necessary and it has no effect.

  • Why Collection interface declares equals() and hashCode() method

    When I went through the source code of Collection interface, I found equals() and hashCode() are declared? Why? If a class implements this interface, it will inherit these two method from Object, and we can true to override them.

    It's probably so that they can provide the documentation that you see there.

  • Would like to declare a variable Public/Global in an IF statement

    Is there way to declare a variable as Public in an IF statement. My goal is to declare the variable as global (since this variable is used somewhere in the code and should not get initialized when there is loop back to the top of the code, hence using IF statement to control the initialization) based on the IF condition and then use it elsewhere in the code.
    I have it like this
    if (!sei_second_jsp.equals("1"))
    public int[] mecitem;
    public String[] sei_mfg_prod_cat;
    public String[] sei_part_number;
    public String[] sei_descrip;
    public String[] sei_price;
    public int[] sei_onhand;
    public int[] sei_demand;
    mecitem = new int[20000];
    sei_mfg_prod_cat = new String[20000];
    sei_part_number = new String[20000];
    sei_descrip = new String[20000];
    sei_price = new String[20000];
    sei_onhand = new int[20000];
    sei_demand = new int[20000];
    for (int i=0; i<=19999; i++)
    mecitem[i] = 0;
    sei_mfg_prod_cat[i] = " ";
    sei_part_number[i] = " ";
    sei_descrip[i] = " ";
    sei_price[i] = " ";
    sei_onhand[i] = 0;
    sei_demand[i] = 0;
    Your guess is right, I am using this code in JSP - since this is a Java related question, thought of posting it in JAVA forum.
    When I use the above code, I get the following error
    1809 }' expected. { 
    1811 Statement expected. public int[] mecitem;
    1827 Identifier expected. mecitem = new int[20000];
    1827 Can't specify array dimension in a declaration. mecitem = new int[20000];
    1827 Identifier expected. mecitem = new int[20000];
    1837 Can't specify array dimension in a declaration. sei_onhand = new int[20000];
    1837 Identifier expected. sei_onhand = new int[20000];
    1839 Can't specify array dimension in a declaration. sei_demand = new int[20000];
    1839 Identifier expected. sei_demand = new int[20000];
    3117 Class or interface declaration expected. }

    Please note the above code in the JSP is submitting to itself and I donot want it to get initialized if the IF statement is not successful..
    thnks a lot for your time.. !!!

  • Use of generics in the Map interface

    After using Java 1.5 for a while, I've gotten pretty comfortable using generics and the collections framework. Very often, I depend on the new generics-related compiler warnings to guide me when I've made changes to my code. Recently, I missed a fairly subtle bug because of the following issue. Why isn't the get() method in the java.util.Map interface declared as:
    V get(K key);Is there some subtle reason why this method isn't declared to enforce the generic type K for the key value? Likewise for containsKey() and remove() as well.
    Thanks!

    So where is the problem to use K in the first
    place??The cast to K is removed during complilation. It's
    not going to do anything at runtime.
    Just because a reference is of type Object doesn't
    mean it's not a K.
    If I get an Object of unknown type, why should I have
    to down-cast it just so that I can check to see
    whether it is in the Map?
    To state the point I wrote this simple code:
            Map<String,Integer> testMap = new TreeMap<String,Integer>();
            testMap.put("test", Integer.valueOf(100));
            // test the get method
            Integer value = testMap.get("test");
            System.out.println("First value: " + value);
            // test the method with differing parameter
            value = testMap.get(Float.valueOf(2));
            System.out.println("Second value: " + value);The code compiles without any error (so far so good) but the execution of this code results in Exception in thread "main" java.lang.ClassCastException: java.lang.String
         at java.lang.Float.compareTo(Unknown Source)
         at java.util.TreeMap.compare(Unknown Source)
         at java.util.TreeMap.getEntry(Unknown Source)
         at java.util.TreeMap.get(Unknown Source)
         at MapTest.main(MapTest.java:27)So when the Object parameter is allowed (I'm okay with that) why the ClassCastException. A similar approach to the implementations of Lists would be necessary. The current implementation is not satisfactory.

  • "should be declared abstract" error message Help !

    Dear People,
    I have two error messages in my program
    "should be declared abstract"
    "getAudioClip() not found "
    Your advice is appreciated
    Norman
    "MyMusicApplet_1.java": Error #: 454 : class stan_my_music_applet_1.MyMusicApplet_1 should be declared abstract; it does not define method getStreamKeys() in interface java.applet.AppletContext at line 9
    "MyMusicApplet_1.java": Error #: 300 : method getAudioClip(java.lang.String) not found in class stan_my_music_applet_1.MyMusicApplet_1
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.applet.*;
    import java.awt.event.*;
    public class MyMusicApplet_1 extends JApplet implements ActionListener, AppletContext
         //AppletContext myAppletContext =   new AppletContext();
         //Iterator i =   myAppletContext.getStreamKeys();
         JButton myJButton;
         AudioClip acSound_1 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk");
         AudioClip acSound_2 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_3 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_4 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_5 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_6 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_7 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_8 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_9 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         JButton myJButtonSound1;
         JButton myJButtonSound2;
         JButton myJButtonSound3;
         JButton myJButtonSound4;
         JButton myJButtonSound5;
         JButton myJButtonSound6;
         JButton myJButtonSound7;
         JButton myJButtonSound8;
         JButton myJButtonSound9;
      public void init()
           Container myContentPane = getContentPane();
           myContentPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            Dimension buttonSize = new Dimension(190,100);
           Font myFont = new Font("Arial", Font.BOLD,14);
           Border myEdge = BorderFactory.createRaisedBevelBorder();
                    //create 1st button's object
                     myJButtonSound1 = new JButton("sound #1");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound1.setBorder(myEdge);
                   myJButtonSound1.setPreferredSize(buttonSize);
                   myJButtonSound1.setFont(myFont);
                   myJButtonSound1.setBackground(Color.orange);
                   myJButtonSound1.setForeground(Color.black);
                    //create 2nd button's object
                     myJButtonSound2 = new JButton("sound #2");
                    myJButtonSound2.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound2.setBorder(myEdge);
                   myJButtonSound2.setPreferredSize(buttonSize);
                   myJButtonSound2.setFont(myFont);
                   myJButtonSound2.setBackground(Color.blue);
                   myJButtonSound2.setForeground(Color.black);
                    //create 3rd button's object
                     myJButtonSound3 = new JButton("sound #3");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound3.setBorder(myEdge);
                   myJButtonSound3.setPreferredSize(buttonSize);
                   myJButtonSound3.setFont(myFont);
                   myJButtonSound3.setBackground(Color.cyan);
                   myJButtonSound3.setForeground(Color.black);
                    //create 4th button's object
                     myJButtonSound4 = new JButton("sound #4");
                    myJButtonSound4.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound4.setBorder(myEdge);
                   myJButtonSound4.setPreferredSize(buttonSize);
                   myJButtonSound4.setFont(myFont);
                   myJButtonSound4.setBackground(Color.pink);
                   myJButtonSound4.setForeground(Color.black);
                   //create 5th button's object
                   myJButtonSound5 = new JButton("sound #5");
                  myJButtonSound5.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound5.setBorder(myEdge);
                 myJButtonSound5.setPreferredSize(buttonSize);
                 myJButtonSound5.setFont(myFont);
                 myJButtonSound5.setBackground(Color.red);
                 myJButtonSound5.setForeground(Color.black);
                  //create 6th button's object
                   myJButtonSound6 = new JButton("sound #6");
                  myJButtonSound6.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound6.setBorder(myEdge);
                 myJButtonSound6.setPreferredSize(buttonSize);
                 myJButtonSound6.setFont(myFont);
                 myJButtonSound6.setBackground(Color.pink);
                 myJButtonSound6.setForeground(Color.black);
                  //create 7th button's object
                   myJButtonSound7 = new JButton("Choice #7");
                  myJButtonSound7.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound7.setBorder(myEdge);
                 myJButtonSound7.setPreferredSize(buttonSize);
                 myJButtonSound7.setFont(myFont);
                 myJButtonSound7.setBackground(Color.cyan);
                 myJButtonSound7.setForeground(Color.black);
                  //create 8th button's object
                   myJButtonSound8 = new JButton("Choice #8");
                  myJButtonSound8.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound8.setBorder(myEdge);
                 myJButtonSound8.setPreferredSize(buttonSize);
                 myJButtonSound8.setFont(myFont);
                 myJButtonSound8.setBackground(Color.yellow);
                 myJButtonSound8.setForeground(Color.black);
                  //create 9th button's object
                   myJButtonSound9 = new JButton("Choice #9");
                  myJButtonSound9.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound9.setBorder(myEdge);
                 myJButtonSound9.setPreferredSize(buttonSize);
                 myJButtonSound9.setFont(myFont);
                 myJButtonSound9.setBackground(Color.blue);
                 myJButtonSound9.setForeground(Color.black);
                   //add the buttons to the content pane
                   myContentPane.add(myJButtonSound1);
                   myContentPane.add(myJButtonSound2);
                   myContentPane.add(myJButtonSound3);
                   myContentPane.add(myJButtonSound4);
                   myContentPane.add(myJButtonSound5);
                   myContentPane.add(myJButtonSound6);
                   myContentPane.add(myJButtonSound7);
                   myContentPane.add(myJButtonSound8);
                   myContentPane.add(myJButtonSound9);
          public void actionPerformed(ActionEvent e)
             myJButton = (JButton)e.getSource();
            if(myJButton == myJButtonSound1)
              acSound_1.play();
            if(myJButton == myJButtonSound2)
              acSound_2.play();
            if(myJButton == myJButtonSound3)
              acSound_3.play();
            if(myJButton == myJButtonSound4)
              acSound_4.play();
            if(myJButton == myJButtonSound5)
              acSound_5.play();
             if(myJButton == myJButtonSound6)
               acSound_6.play();
                       if(myJButton == myJButtonSound7)
                         acSound_7.play();
                       if(myJButton == myJButtonSound8)
                         acSound_8.play();
                        if(myJButton == myJButtonSound9)
                          acSound_9.play();
      }

    The "should be declared abstract" error message means that you have either extended an abstract class with abstract methods that you have not implemented, or you have implemented an interface and not implemented all of its methods. Non abstract classes have to implement all methods that their base classes or interfaces declare.
    The "getAudioClip() not found" error message means that the compiler could not find the method getAudioClip(). Either your class or one of its base classes has to define this method.

  • Interface v/s Abstract Interface

    I am bit confused in one place during the declaration of Interface. as you know I can define a Inteface in two way,
    a) public interface InterfaceTest {
         public void test();
    b) public abstract interface InterfaceTest {
         public abstract void test();
    In first case I declare a normal Interface and in second case done with a abstract keyword. Both are working in a same manner.
    But when Java allow us to declare it in two ways, the their must be a reason behind the scene.
    Can you explain me the reason behind this tow type of Interface declaration

    Can you explain me the reason behind this tow type of Interface declaration JLS says:
    Every interface is implicitly abstract. This modifier is obsolete and should not be used in new programs.

  • Interfaces and methods of Object class

    JSL 2.0 states the following
    If an interface has no direct superinterfaces, then the interface implicitly
    declares a public abstract member method m with signature s, return type r,
    and throws clause t corresponding to each public instance method m with
    signature s, return type r, and throws clause t declared in Object, unless a
    method with the same signature, same return type, and a compatible throws
    clause is explicitly declared by the interface.
    But the following codes produces empty output
    package test;
    import java.lang.reflect.Method;
    public class TestIterface {
        public static void main(String [] args){
            Method [] methods=Y.class.getMethods();
            for(int i=0, n=methods.length;i<n;i++)
                System.out.println(methods);
    interface Y{
    What are the reasons of such behaviour?

    then the interface implicitly declares a public abstract member method
    "Implicit" means that it's implied that the interface declares those methods; unlike java.lang.Object, there is no interface from which all other interfaces descend. All interfaces at the "top" of the inheritance hierarchy are implied to expose at least the same methods as Object.
    Hope this helps...

  • Interface methods with Exceptions

    I have an interface like the following
    public interface FooInterface
         void doMethod() throws Exception;
    }I've created a class which implements the interface
    public class BarClass implements FooInterface
         public void doMethod()
              // Code...
    }Why is it that when I compile the class, no warnings or compiler errors are generated when the exception reference is absent. When I change the signature of the class method to become..
    public void doMethod() throws ExceptionThe compiler error that appears is...
    doMethod() in BarClass cannot implement doMethod() in FooInterface; overridden method does not throw java.lang.Exception
    I'm confused. I recall seeing the opposite. That is, aren't compiler errors generated when I fail to add the exception to the implemented method in the class...Isn't that necessary to comply with the contract specified by the interface..

    When you implement an interface (or override amethod in a parent class)
    you can declare that you throw a narrower set ofexceptions--including
    none--because that doesn't violate the interface's(or parent class')
    promise not to throw more than that exception.Then the interface will define only "as bad as things
    could be" (struggling for words here) but will not
    impose requirements on the class to alert calling
    methods that the exception could be thrown.Yes, the interface is declaring a "things will be no worse than this" promise, but the method still has to declare any unchecked exceptions that it could throw. If the interface says throws FooException, BarException, then the implementing method is allowed to throw FooE, BarE, and any of their children. But if it turns out that my implementation only throws FooE, then I can declare throws FooE and skip the BarE in the implementation. If I also throw BarE, then I have to declare it. If the implementation also throws BazE and doesn't declare it, the compiler will complain about throwin an exception without declaring it, but if I declare it, then I'm violating the interface's contract, and the compiler will complain about that.
    So which exceptions are declared/thrown is bound by a couple of things:
    1) All methods must declare all the unchecked exceptions they throw (or superclass(es) that encompass those exceptions).
    2) Any method that implements an interface cannot declare or throw any unchecked exceptions outside of what the interface declares.
    2a) But it can declare/throw less
    2b) But it still has to declare what it throws.
    >
    A user of your class who codes to the interfacestill has to handle the
    exception that the interface throws. If they code toyour implementing
    class, then they only have to handle whateverexceptions it throws--i.e.
    a (possibly) empty subset of what the interfacedeclares.
    This sounds like the class should declare that the
    method could throw an exception... I'm not sure what
    you mean by code to the interface vs code to the
    implementing class..I've compiled a class which
    implements an interface, the method in which includes
    an Exception Specification. The class, however,
    compiles without any mention of the Exception. Are
    you saying that methods which call the method in the
    class, must be prepared to catch the Exception of the
    method which is implemented from the interface,
    regardless of whether it is even announced in the
    class?... It is implicitly passed on then..
    interface Foo {
        void foo() throws FooE;
    class FooImpl implements Foo {
        public void foo() { // I don't throw any exceptions, so I needn't declare anything
            // do nothing
    // coding to the interface--the preferred way. All I know about f1 is that it's a Foo
    Foo f1 = new FooImpl();
    // coding to the implementation. I know that f2 is a FooImpl which implements Foo
    FooImpl f2 = new FooImpl();
    // f1 is a Foo, and therefore can throw FooE
    try {
        f1.foo();
    catch (FooE exc) {
        // handle
    // f2 is a FooImpl, and therefore we know it throws no exceptions
    f2.foo();Now that I think about it, I'm actually not 100% sure that my claims about having to catch only the implementation's exceptions (none, here) if you code to the implementation are accurate. I suggest you put the above code into some boilerplate and see if it compiles.

  • Error WWW_FLOW_SECURITY. should be declared

    Hi,
    I install Apex 3.1.2, and when I have to change the password for admin I become the error:
    WWW_FLOW_SECURITY.G_SECURITY_GROUP_ID should be declared
    WWW_FLOW_SECURITY.G_USER should be declared
    WWW_FLOW_SECURITY.G_IMPORT_IN_PROGRESS should be declared
    WWW_FLOW_SECURITY.G should be declared
    I can not define a password for admin, eather using:
    @apxxepwd.sql or
    @apxchpwd.sql
    What can I do?
    Thanks
    Gissel

    The "should be declared abstract" error message means that you have either extended an abstract class with abstract methods that you have not implemented, or you have implemented an interface and not implemented all of its methods. Non abstract classes have to implement all methods that their base classes or interfaces declare.
    The "getAudioClip() not found" error message means that the compiler could not find the method getAudioClip(). Either your class or one of its base classes has to define this method.

  • Regarding interfaces?

    Mapping data for interfaces between SAP and Non-SAP systems?
    What are the things involved in it
    Please explain me and if you have any documents regarding pls let me know
    pls forward the doc if any to [email protected]

    satishnarayan wrote:
    HI
    I have doubt regarding interface concept.That is in my interface 7 methods are already available.that interface was implementd by 3 classes.like class a,class b,class c.in future i will add some extra method to that interface but that method will usefull only in class a
    but it will not usefull in class b, class c. how can i achieve this type of scenario.plese give the answer.
    Thanks and regardsAccording to your example the additional methods should NOT be added to the interface. An interface should only include the methods relevant to all of the classes implementing it. Any method not related to theinterface itself should not be in there.
    Add your methods to class a or create a second interface declaring the methods you need.

Maybe you are looking for

  • Why I can't use Home Sharing on my iPad mini?

    Hi! I have an iPad mini (first generation) and an Asus PC with Windows 8 (with the latest iTunes). I have try to enable home sharing on my tablet but in my music app there isn't a more tab. So how can I share content with my computer? All the setting

  • How can I add additional submenu items to Spry Menu Bar?

    The drop down header only allows for for 2 submenus - ie. child and grandchild pages How can I add a third or fourth submenu - ie great grandchild and great great grandchild pages?

  • How To Sync iCal and Address Book in Windows 7

    Hi. I have using mobileme for years and now icloud. I have all my files in my idisk account and they work flawless in my macmini, iphone, etc Now I have to work with a PC with Windows 7 at the office and need to get, edit and add apointments and cont

  • HP Office Jet Pro 8610 won't save as PDF

    After scanning I hit save and it saves it as a bitmap even when I change it to pdf.

  • File to Idoc (message split)

    Hi Gurus, I have a incoming xml file which is split into multiple debmas idoc for ecc. In message-mapping, message-tab source message occurance is set as '1' and target is set with "0...unbound" On target:idoc There is NO mapping for Messages and Mes