Multiple inheritence occured in java?

we know java doest support multiple inheritence
we know the super class for all java classes is Object
ex:
class A
class B extends A
here A extending Object
and B extending Object(by default ) and extendin A
is multiple in heritence occured
if u say its multilevel inheritence how will u prove that programatical?

we know java doest support multiple inheritence
we know the super class for all java classes is
Object
ex:
class A
class B extends A
here A extending Object
and B extending Object(by default ) and extendin A
is multiple in heritence occuredno, multiple inheritance occurs when a type directly inherits from more than one other type
if u say its multilevel inheritence how will u prove
that programatical?huh ?

Similar Messages

  • I acheived Multiple Inheritence in JAVA !!!!!!!!

    Hi,
    Im in ob_imit2_a2 group. I can use member variables and methods of two(or more) classes in another class without importing them just like Multiple Inheritence in C++.
    TECHNICAL COMMENTS REQUIRED
    See Below
    ///////// Outer.java
    public class Outer implements myInterface, myInterface2{
    public Outer() {
    System.out.println("outer class");
    public void check()
         inter2.test();
         inter.test();
    ////////// myInterface.java
    interface myInterface{
    class interclass{
         interclass()
              System.out.println("SS");
         public void test()
              System.out.println("TEST");
    public interclass inter=new interclass();
    //////////myInterface2.java
    interface myInterface2{
    class interclass2{
         interclass2()
              System.out.println("SS 2");
         public void test()
              System.out.println("TEST 2");
    public interclass2 inter2=new interclass2();
    //////////// Main.java
    public class Main {
    public static void main(String abc[]) {
    Outer o = new Outer();
         o.check();
    }

    Any and all variables declared in an interface are always implicitly public, static, and final; meaning that they are constants and NOT member variables. You can call these methods directly from the main method (a static scope) as well; meaning that they are not associated with any instance of the class Outer; i.e. they are NOT inherited.
    The difference between inheritance (extending) and realization (implementing) is that when extending you inherit everything from your parent class, and while implementing you are taking up a role and agree to fulfill all the responsibilities (methods) of that role.

  • Why  multiple inheritence is avoided in java.

    why multiple inheritence is avoided in java.
    r there any advantages in this???
    can u briefly explain with programming so that it will be clear.

    Here is one of several discussions of this topic to be found on the web:
    http://csis.pace.edu/~bergin/patterns/multipleinheritance.html

  • Is Java allow multiple inheritence?

    Hi,
    I am having class A and class B, and class A exteds Class B. All class in Java extends Object class by default,
    1. class B extends one class Object
    2. class A extends two classes class B and class Object.
    Now class A extending two classes is it correct?
    Kindly help me.

    RajivGuna wrote:
    Hi,
    I am having class A and class B, and class A exteds Class B. All class in Java extends Object class by default,
    1. class B extends one class Object
    2. class A extends two classes class B and class Object.
    Now class A extending two classes is it correct?
    Kindly help me.What you described isnt multiple-inheritence , more like multi-level inheritence .Java allows a maximum of one direct superclass for a class , and the situation you described doesnt violate that restriction.

  • Implementation of multiple inheritence

    hi
    i am goutam.how can we implement multiple inheritence in java.and how two super classes can be inherited in one sub class

    keep it to one thread, please!

  • Interfaces to replace multiple inheritence

    Howdy,
    I have, conceptually, the following situation: I have a Ball abstract class. The Ball has several
    concrete methods. It also has an abstract method getAppearance (that would somehow return how a
    Ball is visualized). I have several "adjective" subclasses that I would like to build from it, for example:
    SpikyBall, GlowingBall, ColorBall, etc. I would like these classes to be concrete.
    Additionally, I would like to have a concrete class of any permutation of this list of adjectives, for example:
    SpikyColorBall, GlowingColorBall, SpikyGlowingColorBall. I want to accomplish this
    using as little code rewriting as possible, and, hopefully, none at all.
    Using certain other single letter languages that I won't name here, I used Multiple Inheritence. A
    SpikyColorBall would inherit from both SpikyBall and ColorBall, who both inherited from
    Ball. I was told I could accomplish this in Java using interfaces instead of multiple inheritence, which
    Java doesn't support. How is this accomplished? Could you give me (or forward me to) a good
    example? Again, the power I'm looking for is multiple inheritence's code-reusability.
    As a side note, why did Java choose to use interfaces instead of multiple inheritence?

    Courtesy of yawmark...
    composition_v_inheritance
    Bruce Eckel, author of Thinking In Java, has this to say about composition vs. inheritance:
    When deciding between inheritance and composition, ask if you need to upcast to the base type. If not, prefer composition (member objects) to inheritance. This can eliminate the perceived need for multiple base types. If you inherit, users will think they are supposed to upcast.
    Choose composition first when creating new classes from existing classes. You should only used inheritance if it is required by your design. If you use inheritance where composition will work, your designs will become needlessly complicated.
    Bill Venners: Composition versus Inheritance
    Use inheritance (of implementation) only when the class satisfies the following criteria:
    1) "Is a special kind of," not "is a role played by a";
    2) Never needs to transmute to be an object in some other class;
    3) Extends rather than overrides or nullifies superclass;
    4) Does not subclass what is merely a utility class (useful functionality you'd like to reuse); and
    5) Within PD: expresses special kinds of roles, transactions, or things.
    -- from Java Design: Building Better Apps and Applets (2nd Edition), by Peter Coad and Mark Mayfield

  • Help - Multiple errors occurred on the server while processing commands

    I am trying to start ical server on a fresh install of os x server 10.5, but I receive the following error messages: "Multiple errors occurred on the server while processing commands. Use the console application to view the error message" then I hit "ok" and then if i try to enable the iCal service, up pops up another window saying: "an error occurred onthe server while processing a command. Error 'CANNOTLOAD_BUNDLEERR' occurred while processing a command of type 'writeSettings' in plug-in 'servermgr_calendar'
    what's going on? how do i proceed to enable the iCal service? here is my error log:
    servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:22:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:23:50 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a398170>
    May 25 13:23:50 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'readSettings' in plug-in: 'servermgr_calendar'
    May 25 13:23:51 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a390c30>
    May 25 13:23:51 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'getState' in plug-in: 'servermgr_calendar'
    May 25 13:23:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:23:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:23:58 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a3cabf0>
    May 25 13:23:58 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'setState' in plug-in: 'servermgr_calendar'
    May 25 13:24:04 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a396e50>
    May 25 13:24:04 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'readSettings' in plug-in: 'servermgr_calendar'
    May 25 13:24:05 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a396370>
    May 25 13:24:05 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'getState' in plug-in: 'servermgr_calendar'
    May 25 13:24:10 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a38ad80>
    May 25 13:24:10 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'writeSettings' in plug-in: 'servermgr_calendar'
    May 25 13:24:14 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a3d6980>
    May 25 13:24:14 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'writeSettings' in plug-in: 'servermgr_calendar'
    May 25 13:24:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:24:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:25:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:25:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:26:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:26:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:27:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:27:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:28:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:28:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:29:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:29:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:30:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:30:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:31:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:31:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:32:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:32:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:33:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:33:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:34:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:34:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:35:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:35:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:36:59 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:36:59 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:37:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:37:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:38:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:38:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:39:14 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a39a0d0>
    May 25 13:39:14 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'getState' in plug-in: 'servermgr_calendar'
    May 25 13:39:14 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a39b2a0>
    May 25 13:39:14 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'readSettings' in plug-in: 'servermgr_calendar'
    May 25 13:39:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:39:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:40:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:40:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:41:33 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a3d55b0>
    May 25 13:41:33 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'getState' in plug-in: 'servermgr_calendar'
    May 25 13:41:34 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a3c1ba0>
    May 25 13:41:34 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'readSettings' in plug-in: 'servermgr_calendar'
    May 25 13:41:36 plgs-server Server Preferences[70930]: XSAdminQueueController: gotServerError: CANNOTLOAD_BUNDLEERR forTransaction: <XSAdminTransaction: 0x1a3835c0>
    May 25 13:41:36 plgs-server Server Preferences[70930]: ERROR: The server 'PLG-Server.local' reported the error: 'CANNOTLOAD_BUNDLEERR' while processing a command of type: 'writeSettings' in plug-in: 'servermgr_calendar'
    May 25 13:41:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:41:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes
    May 25 13:42:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; using default group services settings
    May 25 13:42:54 plgs-server servermgrd[56]: servermgr_web: Unable to get valid response from servermgr_teams; no themes

    no idea how to set up a dns. can you point me in the right direction? thanks

  • An unhandled win32 exception occured in java.exe , While running JNI

    I'm trying to use JNI to call 3rd party VB DLL , like this
    JNI <> VC++ DLL <> VB DLL
    In VC++DLL ,I have function(named Open) that call 3 function in VBDLL
    I have tested c++ code this function (by copy it and paste in normal vc++ project) ,and It works !
    But when I call this function(Open) via JNI , I've got "An unhandled win32 exception occured in java.exe" by Visual Studio Just-in-Time Debugger !!
    I think the problem is in the 3rd function that I call in Open, because when I remove the 3rd function It doesn't raise any exception.
    Before I do this, I alrealdy test every function in VBDLL in VB Project , and they work fine (Include the 3rd function that I think It cause exception).
    Can anybody tell me what's going on here ?
    or anything that I can do to fine What cause this problem ?
    Thanks in advance ^^
    Edited by: voteforpedro on Sep 2, 2008 4:18 AM

    You either have a pointer problem or you are calling the 3rd party library in an unexpected fashion.
    In terms of testing the most likely reason is that it wasn't tested enough. Moving/changing code modifies the layout in memory which can expose previously hidden pointer problems.

  • Is multiple inheritence is possible in sap?

    can any one help me?
    is multiple inheritence possible in sap ?
    and is one class can extend multiplre interfaces??

    Hi,
            Multiple inheritance as a concept is not allowed in ABAP Objects. But the effect and behaviour that you get by multiple inheritance is acheviable in ABAP objects with the help of interfaces. As follows.
    An interface can inlcude more than one interface, that is an interface can extend more than one interface. Now if you have say interface1, interface2 and interface3.
    interface4 can be declared to include all three other interfaces. And you class can include this interface4 in its interfaces tab.
    Due to this your class gets the behviour(methods) that is defined in all ther interfaces. You can assign an object of this class to a reference of any one of these four interfaces. So one object can react to method calls on four different interfaces which is what you want to achevie in multiple inheritance.
    Regards,
    Sesh

  • Multiple Inheritence/Const Compiler bug

    I'm encountering what appears to be a bug when mixing multiple inheritence & const/non-const methods. The compiler (WorkShop 6 Update 2) is accepting the following ill-formed code :
    class Base1 {
    int a; //If Base1 is empty, the problem doesn't appear.
    //A virtual function elicits the bug as well.
    class Base2 {
    public:
    void mutator() { //non-const method   
    class Derived : public Base1, public Base2 {
    class Foo {
    private:
    Derived my_derived;
    public:
    void f() const {
    my_derived.mutator();
    int main (int argc, char* argv[])
    Foo my_foo;
    my_foo.f();
    Note how f() in class Foo is const, yet attempts to call mutator(), a non-const method that my_derived gets via inheritence to Base2. This is ill formed and should, I believe, yield a compiler error. If the code is just subtly changed, the correct error will appear. For instance, if Base1 is empty, the appropriate error appears. Alternatively, if Base2 appears before Base1 in Derived's inheritence list, then the appropriate error appears.
    Is this a known problem? Is there a patch available? I'm very concerned that this bug is allowing const-incorrect code to be developed unknowingly, as it has in the project I'm involved in.
    Thanks in advance for giving this your attention!
    David Michael

    The bug report hasn't been filed yet. If you have contract with Sun, please follow the service channel to file the report. Otherwise, I can do it for you. Please provide:
    - O/S version
    - Architecture
    Please notice that if you don't have contract with sun, the bug might be in a low priority.
    - Rose

  • What is single inheritance, multiple inheritance, and describe Java's notio

    What is single inheritance, multiple inheritance, and describe Java's notion of an interface?
    Can you give me example or reference link? thx

    Single inheritance is getting features like data and methods (functions) from a so called parent class. multiple inheritance is the same but you derive features from multiple parent classes (not supported by java). Interfaces are a way around this because you can inherit multiple interfaces. Inheriting from interfaces is like a promise to implement certain methods that these interfaces define but doesn't implement themselves.
    check around java.sun.com in the tutorials section, you can probably find a text that describes object oriented program and how it is implemented in java.

  • Multiple MIDI Sequencers In Java Applet?

    Hi all,
    I'm working on a music applet and need to have multiple MIDI sequencers playing simultaneously. I have some test code and it works in my IDE (I'm using JGrasp) but when I try to open the applet in a web browser, it doesn't play the sequencers at the same time. It only plays one sequencer at a time and switches (seems to be random) back and forth between them instead of just letting them both play together. Is there any reason why two (or more) sequencers won't play together in an applet when they do in JGrasp? Is this just simply a limitation within applets or is there some kind of work around to fix this?
    I know you can do different tracks/channels in a single sequencer, but I really need it to be separate sequencers playing simultaneously... Without getting into too much music/drum theory, I'm making a polyrhythm metronome and need to have different sequencers playing at different tempos (which you can't do with a single sequencer). If anyone has any ideas on how to get multiple sequencers to play nicely together in an applet that would be greatly appreciated.
    Here is my sample program:
    import java.util.*;
    import javax.swing.*;
    import javax.sound.midi.*;
    public class MetronomeTestApplet extends JApplet
         public void init()
              MetronomeTest metTest = new MetronomeTest();
              metTest.play();
    class MetronomeTest
         Sequencer sequencer1=null;
         Sequencer sequencer2=null;
         Sequence sequence1=null;
         Sequence sequence2=null;
         Track track1=null;
         Track track2=null;
         MidiEvent newEvent=null;
         int volume = 90;     
         int tempo     = 100;
         public MetronomeTest()
              try
              {     // SEQUENCER 1
                   sequencer1 = MidiSystem.getSequencer();
                   sequencer1.open();
                   sequence1 = new Sequence(Sequence.PPQ, 16);
                   track1 = sequence1.createTrack();
                   ShortMessage instrumentMsg = new ShortMessage();
                   instrumentMsg.setMessage(ShortMessage.PROGRAM_CHANGE, 0, 115, 0);          // 115 == woodblock
                   track1.add(new MidiEvent(instrumentMsg, 0));
                   // SEQUENCER 2
                   sequencer2 = MidiSystem.getSequencer();
                   sequencer2.open();
                   sequence2 = new Sequence(Sequence.PPQ, 16);
                   track2 = sequence2.createTrack();
                   instrumentMsg = new ShortMessage();
                   instrumentMsg.setMessage(ShortMessage.PROGRAM_CHANGE, 0, 117, 0);          // 117 == melodic tom
                   track2.add(new MidiEvent(instrumentMsg, 0));
              catch (Exception e) { e.printStackTrace(); }
         public void destroy()
              sequencer1.stop();
              sequencer1.close();
              sequencer2.stop();
              sequencer2.close();
         public void play()
              try
                   // LOAD SEQUENCE 1               
                   for (int i=0; i<4; i++)
                        ShortMessage noteOnMsg = new ShortMessage();
                        noteOnMsg.setMessage(ShortMessage.NOTE_ON, 0, 60, volume);
                        track1.add(new MidiEvent(noteOnMsg, 0 + 16*i));
                        ShortMessage noteOffMsg = new ShortMessage();
                        noteOffMsg.setMessage(ShortMessage.NOTE_OFF, 0, 60, volume);
                        track1.add(new MidiEvent(noteOffMsg, 16 + 16*i));
                   // LOAD SEQUENCE 2               
                   for (int i=0; i<8; i++)
                        ShortMessage noteOnMsg = new ShortMessage();
                        noteOnMsg.setMessage(ShortMessage.NOTE_ON, 0, 60, volume);
                        track2.add(new MidiEvent(noteOnMsg, 0 + 8*i));
                        ShortMessage noteOffMsg = new ShortMessage();
                        noteOffMsg.setMessage(ShortMessage.NOTE_OFF, 0, 60, volume);
                        track2.add(new MidiEvent(noteOffMsg, 8 + 8*i));
                   // LOAD AND START SEQUENCERS
                   sequencer1.setSequence(sequence1);
                   sequencer1.setTempoInBPM(tempo);
                   sequencer1.setLoopCount(Sequencer.LOOP_CONTINUOUSLY);
                   sequencer2.setSequence(sequence2);
                   sequencer2.setTempoInBPM(tempo);
                   sequencer2.setLoopCount(Sequencer.LOOP_CONTINUOUSLY);
                   sequencer1.start();
                   sequencer2.start();
              catch (Exception e) { e.printStackTrace(); }
    }And the code for my html document:
    <html>
    <body>
    <CENTER><applet code="MetronomeTestApplet.class" width="1000" height="700"></applet></CENTER>
    </body>
    </html>Thanks,
    -tkr
    Edited by: Tekker on Nov 21, 2010 5:45 PM

    I just tried implementing the sequencers in their own threads but unfortunately it gives exactly the same results, where it works in JGrasp but not in the web browser.
    Here's the threaded version:
    import java.util.*;
    import javax.swing.*;
    import javax.sound.midi.*;
    public class MetronomeTestApplet extends JApplet
         MetronomeTest metronome1;
         MetronomeTest metronome2;
         public void init()
              metronome1 = new MetronomeTest(50, 115);          // (tempo, instrument)          115 = woodblock
              metronome2 = new MetronomeTest(100, 117);          // (tempo, instrument)          117 = melodic tom     
              metronome1.start();
              metronome2.start();
         public void destroy()
              metronome1.close();
              metronome2.close();
    class MetronomeTest extends Thread
         Sequencer sequencer=null;
         Sequence sequence=null;
         Track track=null;
         MidiEvent newEvent=null;
         int volume = 90;     
         int tempo = 100;
         public MetronomeTest(int tempo, int instrument)
              this.tempo = tempo;
              try
              {     sequencer = MidiSystem.getSequencer();
                   sequencer.open();
                   sequence = new Sequence(Sequence.PPQ, 16);
                   track = sequence.createTrack();
                   ShortMessage instrumentMsg = new ShortMessage();
                   instrumentMsg.setMessage(ShortMessage.PROGRAM_CHANGE, 0, instrument, 0);
                   track.add(new MidiEvent(instrumentMsg, 0));
              catch (Exception e) { e.printStackTrace(); }
         public void close()
              sequencer.stop();
              sequencer.close();
         public void run()
              try
              {     for (int i=0; i<4; i++)
                   {     ShortMessage noteOnMsg = new ShortMessage();
                        noteOnMsg.setMessage(ShortMessage.NOTE_ON, 0, 60, volume);
                        track.add(new MidiEvent(noteOnMsg, 0 + 16*i));
                        ShortMessage noteOffMsg = new ShortMessage();
                        noteOffMsg.setMessage(ShortMessage.NOTE_OFF, 0, 60, volume);
                        track.add(new MidiEvent(noteOffMsg, 16 + 16*i));
                   sequencer.setSequence(sequence);
                   sequencer.setTempoInBPM(tempo);
                   sequencer.setLoopCount(Sequencer.LOOP_CONTINUOUSLY);
                   sequencer.start();
              catch (Exception e) { e.printStackTrace(); }
    }If you have more things I can try, I'd greatly appreciate it. :)
    Thanks,
    -tkr

  • Multiple selection needed in Java webDynpro

    In Java webDynpro, i need multiple selection to be performed in a combo or listbox. For that, what is the control that i have to add n what are the properties that i have to change. It is urgent. Pl help me in this.

    Hi
    You can use the ChaeckBoxGroup  UI element for multiple selection.
    Kind Regards
    Mukesh

  • Multiple Server nodes in Java Instance

    Hello Experts,
    We have NW 700 SP17 Java system running with 5 server nodes. Would appreciate, if you clarify following doubts:
    1. How can we check which user has landed up into which server node.
    2. Is there any possibility of check logs (like defaulttrace,etc) for all the server nodes from a single location (like NWA).
    3. How can we check the load on each of the server node.
    4. Where can we find documentation on configuring and operating Java instance with multiple server nodes.
    Thanks
    Davinder

    1. How can we check which user has landed up into which server node.
    Ask the user to execute this: javascript:document.cookie
    while they are in the Java pages.
    2. Is there any possibility of check logs (like defaulttrace,etc) for all the server nodes from a single location (like NWA).
    - Yes, SAP LogViewer should give you that options
    3. How can we check the load on each of the server node -
    - Consider configuring Solution Manager Diagnostics, is it very nice tool for Java Load Monitoring
    4. Where can we find documentation on configuring and operating Java instance with multiple server nodes
    - If you asking about how many nodes requires on a java instance, you might want to use the SAP Quick Sizer to size your systems, then it will give you total Memory it requirsts then you need to divide that by 2.5 GB (64 bit OS) or for 32 bits they recommend you not to exceed your heap size beyond 1 GB.
    Added Nodes is very simple via Configtool, then you might have to setup your server with same settings as your previous nodes.
    Kumar

  • Split XML in Multiple XML files with Java Code

    Hi guys , i have following xml file as input ....
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <T0020
    xsi:schemaLocation="http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.safersys.org/namespaces/T0020V1">
    <INTERFACE>
    <NAME>SAFER</NAME>
    <VERSION>04.02</VERSION>
    </INTERFACE>
    <TRANSACTION>
    <VERSION>01.00</VERSION>
    <OPERATION>REPLACE</OPERATION>
    <DATE_TIME>2009-09-01T00:00:00</DATE_TIME>
    <TZ>CT</TZ>
    </TRANSACTION>
    <IRP_ACCOUNT>
    <IRP_CARRIER_ID_NUMBER>274845</IRP_CARRIER_ID_NUMBER>
    <IRP_BASE_COUNTRY>US</IRP_BASE_COUNTRY>
    <IRP_BASE_STATE>AR</IRP_BASE_STATE>
    <IRP_ACCOUNT_NUMBER>55002</IRP_ACCOUNT_NUMBER>
    <IRP_ACCOUNT_TYPE>I</IRP_ACCOUNT_TYPE>
    <IRP_STATUS_CODE>100</IRP_STATUS_CODE>
    <IRP_STATUS_DATE>2007-11-06</IRP_STATUS_DATE>
    <IRP_UPDATE_DATE>2009-08-03</IRP_UPDATE_DATE>
    <IRP_NAME>
    <NAME_TYPE>LG</NAME_TYPE>
    <NAME>A P SUPPLY CO</NAME>
    <IRP_ADDRESS>
    <ADDRESS_TYPE>PH</ADDRESS_TYPE>
    <STREET_LINE_1>1400 N OATS</STREET_LINE_1>
    <STREET_LINE_2/>
    <CITY>TEXARKANA</CITY>
    <STATE>AR</STATE>
    <ZIP_CODE>71854</ZIP_CODE>
    <COUNTY>MILLER</COUNTY>
    <COLONIA/>
    <COUNTRY>US</COUNTRY>
    </IRP_ADDRESS>
    <IRP_ADDRESS>
    <ADDRESS_TYPE>MA</ADDRESS_TYPE>
    <STREET_LINE_1>P O BOX 1927</STREET_LINE_1>
    <STREET_LINE_2/>
    <CITY>TEXARKANA</CITY>
    <STATE>AR</STATE>
    <ZIP_CODE>75504</ZIP_CODE>
    <COUNTY/>
    <COLONIA/>
    <COUNTRY>US</COUNTRY>
    </IRP_ADDRESS>
    </IRP_NAME>
    </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    and i want to take this xml file and split it into multiple files through java code like this ...
    File1.xml
    <T0020>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    File2.xml
    <T0020>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    like wise...
    Each xml file contain maximum 10 or 15 IRP_ACCOUNT.
    Can somebody please help me ? How can i do it with stax like start element and all ?
    thanks in advance.

    Ah, sorry, strike that. You want multiple files. I think the easiest way is to simply parse with DOM. [http://www.w3schools.com/xpath/default.asp] . And here [http://www.w3schools.com/xpath/default.asp].
    You can output the various XML elements using a PrintWriter or creating a separate DOM document for each file you want to create and serializing that.
    - Saish

Maybe you are looking for