OOP question involving inheritance

Hello,
I am trying to build an application using OOP, which I am new to, and have a problem. The attached zip file has some dummy code which when run will show the problem, in the stop case. I seem to be able to add classes to a parent, but the parent data is being overwritten apparently.
Tay
Solved!
Go to Solution.
Attachments:
Dummy App.zip ‏141 KB

There is one issue in your code.
Every time you change a state, you take an NEW object. The new object don't know anything about what you have done in a state before.
Therefor it seems that the parents data is overwritten, but that is not the case. You are overwriting the hole objact with a new fresh object, which parent dot have any data.
It is each object that remembers its own data, also what its parent can have, no matter if different classes have the same parent.
The parent - child relation is not a way to share data between objects. it is a way to define a class with commen methods for different classes.

Similar Messages

  • Question regarding Inheritance.Please HELP

    A question regarding Inheritance
    Look at the following code:
    class Tree{}
    class Pine extends Tree{}
    class Oak extends Tree{}
    public class Forest{
    public static void main(String args[]){
      Tree tree = new Pine();
      if( tree instanceof Pine )
      System.out.println( "Pine" );
      if( tree instanceof Tree )
      System.out.println( "Tree" );
      if( tree instanceof Oak )
      System.out.println( "Oak" );
      else System.out.println( "Oops" );
    }If I run this,I get the output of
    Pine
    Oak
    Oops
    My question is:
    How can Tree be an instance of Pine.? Instead Pine is an instance of Tree isnt it?

    The "instanceof" operator checks whether an object is an instance of a class. The object you have is an instance of the class Pine because you created it with "new Pine()," and "instanceof" only confirms this fact: "yes, it's a pine."
    If you changed "new Pine()" to "new Tree()" or "new Oak()" you would get different output because then the object you create is not an instance of Pine anymore.
    If you wonder about the variable type, it doesn't matter, you could have written "Object tree = new Pine()" and get the same result.

  • One very basic question about inheritance

    One very basic question about inheritance.
    Why we need inheritance?
    the benefit of inheritance also achieve by creating instance of base class using it in other class instead of extending the base class.
    Can any one please explain why we are using inheritance instead of creating object of base class????

    SumitThokal wrote:
    One very basic question about inheritance.
    Why we need inheritance?
    the benefit of inheritance also achieve by creating instance of base class using it in other class instead of extending the base class.
    Can any one please explain why we are using inheritance instead of creating object of base class????What did you find out when you looked on Google?
    One example of inheritance comes in the form of a vehicle. Each vehicle has similarities however they differ in their own retrospect. A car is not a bus, a bus is not a truck, and a truck is not a motorbike. If you can define the similarities between these vehicles then you have a class in which you can extend into either of the previous mentioned vehicles. Resulting in a reusable class, dramatically reduces the size of code, creates a single point of definition, increases maintainability, you name it.
    In short there are thousands of benefits from using inheritance, listing the benefits could take a while. A quick Google search should give you a few hundred k if not million links to read.
    Mel

  • OOPS Question

    Hi to all,
    . I am learning Java Now. I am in starting stage. I have a question on OOPS in Java. Is Java Supports Fully Object Oriented Concepts? Is it Fully OOPS Language? Some one told me that *"We Can Access Member Functions of a Class without creating object to that"*. As i know about that we can do that using static keyword. and static keyword is not in the OOPS principals.
    And another reason is *"Java Doesn't Support Multiple Inheritance".* we can do that using Interfaces, and those Interfaces are not part of OOPS. Is those above mentioned two reasons are true? if you know in details, kindly explain me. I am very thankful to you. Thanks in advance.

    jverd wrote:
    rdkh wrote:
    jverd wrote:
    rdkh wrote:
    you can access instance methods without any object instances,No, you cannot.please teach me.
    Please look at my code and tell me what I did wrong?
    (1) I grabbed a reference to "foo()".
    (2) "foo()" is an instance method of "Main".
    (3) there are no instances of "Main"... so, that is impossible???
    No!Yes, there is an instance of Main, and yes, it is impossible to access an instance method without an instance of the class whose method it is (as opposed to accessing an instance of the Method class that represents that method).
    public static void main(String[] args) {
    Method m = Main.class.getMethod("foo", null); // access to instance method but no instance
    m.invoke(new Main(), new Object[0]);  // to execute, an instance is needed
    }m.invoke(new Main()), new Object[0])
    There's also an instance of Method, and instance of Class, an instance of String, and an instance of Object[].
    You cannot invoke an instance method without an instance of the class whose method you're invoking.
    What I did is what I said. I got an instance method of "Main" without creating an instance of "Main". That is what the op wanted.Okay, so you obtained an instance of the Method class that corresponds to a particular instance method in Main, without obtaining an instance of Main. So what? That's totally meaningless. You can't invoke it without an instance of Main.
    Edited by: jverd on Jan 13, 2010 9:55 PMcool.
    thanks very much. appreciated it.

  • A question about inheritance and overwriting

    Hello,
    My question is a bit complicated, so let's first explain the situation with a little pseudo code:
    class A {...}
    class B extends A{...}
    class C extends B {...}
    class D extends C {...}
    class E extends B {...}
    class F {
      ArrayList objects; // contains only objects of classes A to E
      void updateObjects() {
        for(int i = 0; i < objects.size(); i++)
          A object = (A) objects.get(i); // A as superclass
         update(A);
      void update(A object) { ... }
      void update(B object) { ... }
      void update(D object) { ... }
    }My question now:
    For all objects in the objects list the update(? object) method is called. Is it now called with parameter class A each time because the object was casted to A before, or is Java looking for the best fitting routine depending on the objects real class?
    Regards,
    Kai

    Why extends is evil
    Improve your code by replacing concrete base classes with interfaces
    Summary
    Most good designers avoid implementation inheritance (the extends relationship) like the plague. As much as 80 percent of your code should be written entirely in terms of interfaces, not concrete base classes. The Gang of Four Design Patterns book, in fact, is largely about how to replace implementation inheritance with interface inheritance. This article describes why designers have such odd beliefs. (2,300 words; August 1, 2003)
    By Allen Holub
    http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html
    Reveal the magic behind subtype polymorphism
    Behold polymorphism from a type-oriented point of view
    http://www.javaworld.com/javaworld/jw-04-2001/jw-0413-polymorph_p.html
    Summary
    Java developers all too often associate the term polymorphism with an object's ability to magically execute correct method behavior at appropriate points in a program. That behavior is usually associated with overriding inherited class method implementations. However, a careful examination of polymorphism demystifies the magic and reveals that polymorphic behavior is best understood in terms of type, rather than as dependent on overriding implementation inheritance. That understanding allows developers to fully take advantage of polymorphism. (3,600 words) By Wm. Paul Rogers
    multiple inheritance and interfaces
    http://www.javaworld.com/javaqa/2002-07/02-qa-0719-multinheritance.html
    http://java.sun.com/docs/books/tutorial/java/interpack/interfaceDef.html
    http://www.artima.com/intv/abcs.html
    http://www.artima.com/designtechniques/interfaces.html
    http://www.javaworld.com/javaqa/2001-03/02-qa-0323-diamond_p.html
    http://csis.pace.edu/~bergin/patterns/multipleinheritance.html
    http://www.cs.rice.edu/~cork/teachjava/2002/notes/current/node48.html
    http://www.cyberdyne-object-sys.com/oofaq2/DynInh.htm
    http://www.gotw.ca/gotw/037.htm
    http://www.javajunkies.org/index.pl?lastnode_id=2826&node_id=2842
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=1&t=001588
    http://pbl.cc.gatech.edu/cs170/75
    Downcasting and run-time
    http://www.codeguru.com/java/tij/tij0083.shtml
    type identification
    Since you lose the specific type information via an upcast (moving up the inheritance hierarchy), it makes sense that to retrieve the type information ? that is, to move back down the inheritance hierarchy ? you use a downcast. However, you know an upcast is always safe; the base class cannot have a bigger interface than the derived class, therefore every message you send through the base class interface is guaranteed to be accepted. But with a downcast, you don?t really know that a shape (for example) is actually a circle. It could instead be a triangle or square or some other type.
    To solve this problem there must be some way to guarantee that a downcast is correct, so you won?t accidentally cast to the wrong type and then send a message that the object can?t accept. This would be quite unsafe.
    In some languages (like C++) you must perform a special operation in order to get a type-safe downcast, but in Java every cast is checked! So even though it looks like you?re just performing an ordinary parenthesized cast, at run time this cast is checked to ensure that it is in fact the type you think it is. If it isn?t, you get a ClassCastException. This act of checking types at run time is called run-time type identification (RTTI). The following example demonstrates the behavior of RTTI:
    //: RTTI.java
    // Downcasting & Run-Time Type
    // Identification (RTTI)
    import java.util.*;
    class Useful {
    public void f() {}
    public void g() {}
    class MoreUseful extends Useful {
    public void f() {}
    public void g() {}
    public void u() {}
    public void v() {}
    public void w() {}
    public class RTTI {
    public static void main(String[] args) {
    Useful[] x = {
    new Useful(),
    new MoreUseful()
    x[0].f();
    x[1].g();
    // Compile-time: method not found in Useful:
    //! x[1].u();
    ((MoreUseful)x[1]).u(); // Downcast/RTTI
    ((MoreUseful)x[0]).u(); // Exception thrown
    } ///:~
    As in the diagram, MoreUseful extends the interface of Useful. But since it?s inherited, it can also be upcast to a Useful. You can see this happening in the initialization of the array x in main( ). Since both objects in the array are of class Useful, you can send the f( ) and g( ) methods to both, and if you try to call u( ) (which exists only in MoreUseful) you?ll get a compile-time error message.
    If you want to access the extended interface of a MoreUseful object, you can try to downcast. If it?s the correct type, it will be successful. Otherwise, you?ll get a ClassCastException. You don?t need to write any special code for this exception, since it indicates a programmer error that could happen anywhere in a program.
    There?s more to RTTI than a simple cast. For example, there?s a way to see what type you?re dealing with before you try to downcast it. All of Chapter 11 is devoted to the study of different aspects of Java run-time type identification.
    One common principle used to determine when inheritence is being applied correctly is the Liskov Substitution Principle (LSP). This states that an instance of a subclass should be substitutible for an instance of the base class in all circumstances. If not, then it is generally inappropriate to use inheritence - or at least not without properly re-distributing responsibilities across your classes.
    Another common mistake with inheritence are definitions like Employee and Customer as subclasses of People (or whatever). In these cases, it is generally better to employ the Party-Roll pattern where a Person and an Organization or types of Party and a party can be associated with other entities via separate Role classes of which Employee and Customer are two examples.

  • A general OOP question

    Hi
    I have a general OOP design question, and am wondering if someone could relate an answer to the following design?
    I have a class called MediaFolderImport(); - it's designed to build a window with various editing tools in it.
    Within it's constructor, I'm calling a bunch of functions to build the window...
       createTitle();
       createInstructions();
       createToolPanel();
       createDataGrid ();
       createOpen();
       createSave();
    In my document class, I instantiate it...
    public var File_Folder_Import:MediaFolderImport=new MediaFolderImport();
    and then...
    addChild(File_Folder_Import);
    Voila! - the window appears. I WAS very proud of myself.
    Now I want to access something inside the window.  Specifically, there's a radio button that was created in createToolPanel(); - I want to update it to be selected or not selected when I receieve the user's preference from an xml settings file at start up (xml is loaded into the doc class).
    General question:
    What is the best practice, smart way to have designed this?
    - call createToolPanel(); from the doc class instead of within MediaFolderImport();, and somehow (magically) have access to the radio button?
    - leave the design as is, but add some sort of listener within MediaFolderImport that listens for changes to the xml in the doc class, and updates accordingly?
    - do it the way I'm trying to, ie try to access the radio button directly from the doc class (which isn't working):
    File_Folder_Import.myRadioButton.selected = true;
    - a better way someone can briefly explain the concept of?
    Another way to explain my design is...
    - a bunch of different windows, each created by a different class
    - xml file loads preferences, which need to be applied to different tools (radio buttons, check boxes, text fields etc) in the different windows
    I read a lot of posts that talk about how public vars are mostly bad practice.  So if you are making your class vars private, what is the best way to do the kind of inter-class communicating I'm talking about here?
    I think someone throwing light on this will help me solidify my understanding of OOP.
    Thank you for your time and help.

    You're already very used to using properties for the built-in AS classes and that's the best practice means of configuring your class. It's a "state" that you want to simply expose. The get/set method moccamaximum mentioned is the ideal route.
    The main reason you want to use get/set functions is validation. You want your class to act properly if you send an invalid value. Especially if anyone else besides yourself is going to use the class. Plan for the worst.
    The general concept is, make a private variable for any 'state' you want to remember using an underscore in the variable name to easily identify it as a private var, then make get/set functions with the same name with any required validation without the underscore.
    e.g.
    package
         public class MyClass
              // property called 'mode' to track something with an int
               private var _mode:int = 0;
              public function MyClass() {} // empty constructor
              // get (type enforced)
              public function get mode():int { return mode; }
              // set, requiring a value
              public function set isChecked(modeVal:int):void
                   // if no value is sent, ignore
                   if (!modeVal) { return; }
                   _mode = modeVal;
    Your validation will go a long way to easily debugging your classes as they grow in size. Eventually they should throw exceptions and errors if they're not valid. Then you will be best practice. Do note that if your validation requires quite a bit of logic it's common to upgrade the property to a public method. get/set should be reserved for simple properties.

  • OOP Question: Calling Function in Root?

    This is kinda complicated, and I'm still trying to wrap my head around the whole concept of OOP. So right now I am building a XML Gallery, and in the FLA (Root) I've added the thumbnails. Everytime the thumbnails been clicked, it will bring up the "Detail" movieclip, which also is created in the root. And inside the Detail movieclip, I am creating a few buttons with an external class. My question is how can I call a function in the FLA (Root) when I click on the buttons inside the Detail movieclip? Note it seems I've successfully import my external class in both the root and the Detail movieclip.
    I hope I'm making sense. >_<
    Thanks for any help in advance.

    use:
    In the DetailButtons class:
    _button.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
    private function onClick(evt:MouseEvent):void {
         dispatchEvent(new Event("Clicked");
    In the Main FLA / Root:
    var detailButtons:DetailButtons = new DetailButtons();
    addChild(detailButtons);
    detailButtons.addEventListener("Clicked", goBack);
    function goBack(evt:Event):void{
        trace("Go Back");

  • HI  question on inheritance

    Why abap does not support multiple inheritance

    shanthi,
    check the below threads.... same question discussed before also
    multiple inheritance
    Re: Does ABAP Obj. supports multiple or multilevel inheritence
    If you find what ever u r looking for please close the thread...... if u need further info lemme know
    ~~Guduri

  • Three Part Question involving OS 9.2.1 & OS 10.4 on Wallstreet Powerbook

    Please forgive me if there is already a topic on this particular issue. I looked, but was unable to find one.
    NOTE: It was suggested to me that I post this question here, in large part because of a particular member who is a Wallstreet expert. So... here's hoping. :D
    Last year I decided to purchase a Sonnet G4 Upgrade Card for my G3 Wallstreet Powerbook. Due to a variety of resons I won't bore you with, I ended up putting this particular project on the shelf while I was busy with other things.
    Things have slowed down a bit and I want to get back to this project. One of the requirements for this card is that I be running both OS9 & OSX. Therefore, I have to install both OS's.
    I have the OS 9.2.1 disk that came with my purchase of 10.1 when it first came out and the OSX v 10.4 Tiger disk that I bought last year. (FWIW I also have the OS10.1 disk and the 8.5, 8.6 & 9.1 disks.)
    Now that you have the background information, here's my problem: It's been too long since I've done this.
    So here's the 3-Part question:
    1. Do I install both on one partition that takes up the whole 8meg disk or do I make one partition for each OS?
    2. Which OS disk do I use for formatting & partitioning?
    3. Which OS do I install first?
    Thank you in advance for your help.
    ======================================================================
    ======================================================================
    Wallstreet   Other OS  

    eric,
    1) If your HD is 8 GB, I don't believe you want to partition. As you may already know, the Wallstreet has a limitation when it comes to any version of OSX. If the HD is larger than 8 GB, then the HD must be partitioned: The first partition must be less than 8 GB and this partition is used for OSX, but this does not preclude installing 9.x. As the article below states, an 8 GB HD may be slightly larger than 8 GB depending on how the manufacturer sized it. Apple uses 1024K=1 MB vs. a vendor that may use 1000K=1 MB. Having said that, if you boot to the OSX CD and the destination HD is grayed-out, you will have to partition the HD.
    http://docs.info.apple.com/article.html?artnum=106235
    The problem with partitioning a small drive like yours is the wasted space...too much for OSX and not enough for 9.x or vice versa. Since I don't know what apps and files you will be using for both OSes, it is just simpler to have one volume. Both OSes can work quite nicely on the same volume; this is how apple shipped all their new Macs.
    2) Either 9.x's Drive Setup or 10.x's Disk Utility can properly initialize the HD: Use the MacOS Extended Format (HFS Extended); if using Disk Utility, be sure to check the option to install the MacOS 9 HD Driver; if using Drive Setup, it is installed automatically.
    3) I would install 9.x first; make sure everything is up to snuff before installing 10.x. However, either OS can be installed first.
    A few suggestions...
    - Since you probably have the original 8 GB HD, I would boot to your 9.x CD > open Drive Setup in the Utilities folder on the CD > go to Initialization Options > select 'zero all data' > initialize (no partition and HFS Extended). This will thoroughly clean the HD and force sparing (reallocation) of any bad blocks. After zeroing, select Test Disk and make sure it is OK. I suggest using Drive Setup since it has the Test Disk function...Disk Utility does not. Once Drive Setup is launched, Drive Setup Help is available in the menu bar.
    - Once the HD has been prepped, I would boot to your OSX CD and make sure the 8 GB limit does not affect you. If it does, you will have to think about a very small partition to get under the 8 GB limit or larger partitions for each OS. As long as you are booted to OSX, you can go ahead and install it if you wish.
    - If you do install OSX first, to install 9.x you must boot to the 9.x CD and select Clean Install. Also, when installing any 9.x software, boot into 9.x first...do not install when running in Classic.
    http://docs.info.apple.com/article.html?artnum=106294
    - If you want to run your 9.1 as Classic when booted to 10.x, update it to 9.2.2; this will give you the best compatibility.
    - The Wallstreet natively supports up to OSX 10.2.8, but 10.3.x and 10.4.x can run if you use XPostFacto.
    http://eshop.macsales.com/OSXCenter/XPostFacto/
    - Since Tiger came on DVDs and not CDs (unless you used the CD-exchange program), you will not be able to install Tiger on the Wallstreet from your optical drive if you don't have a DVD-ROM drive. I installed Tiger on my Wallstreet by removing the HD, placing it in a FireWire HD enclosure, then connecting it to my iBook and installing Tiger.
    - You can save HD space (about 1.5 GB) by performing a custom install of OSX; here is a sample for Tiger:
    http://docs.info.apple.com/article.html?artnum=301229
    - How much installed memory do you have?
    I covered a lot of ground here so feel free to ask any questions.

  • A little question about inheritance

    Can someone explain this to me?
    I have been reading about inheritance in Java. As I understand it when you extend a class, every method gets "copied" to the subclass. If this is so, how come this doesn't work?
    class inherit {
        int number;
        public inherit(){
            number = 0;
        public inherit(int n){
            number = n;
    class inherit2 extends inherit{
        public inherit2(int n, int p){
            number = n*p;
    class example{
        public static void main(String args[]){
            inherit2 obj = new inherit2();
    }What I try to do here is to extend the class inherit with inherit2. Now the obj Object is of inherit2 class and as such, it should inherit the constructor without parameters in the inherit class or shouldn't it ??? If not, then should I rewrite all the constructors which are the same and then add the new ones??

    I believe you were asking why SubClass doesn't have the "default" constructor... after all, shouldn't SubClass just have all the contents of SuperClass copy-pasted into it? Not exacly. ;)
    (code below... if you'd like, you can skip the first bit, start at the code, and work your way down... depending on if you just started, the next bit may confuse rather than help)
    Constructors are special... interfaces don't specify them, and subclasses don't inherit them. There are many cases where you may not want your subclass to display a constructor from it's superclass. I know this sounds like I'm saying "there are many cases where you won't want a subclass to act exactly like a superclass, and then some (extend their functionality)", but its not, because constructors aren't how an object acts, they're how an object gets created.
    As mlk said, the compiler will automatically create a default constructor, but not if there is already a constructor defined. So, unfortunatley for you, there wont be a default constructor made for SubClass that you could use to create it.
    class SuperClass { //formerly inherit
    int number;
    public SuperClass () { //default constructor
    number = 0;
    public SuperClass (int n) {
    number = n;
    class SubClass extends SuperClass { //formerly inherit2
    //DEFAULT CONSTRUCTOR, public SubClass() WILL NOT BE ADDED BY COMPILER
    public SubClass (int n, int p) {
    number = n*p;
    class Example {
    public static void main(String [] args) {
    //attempted use of default constructor
    //on a default constructorless subclass!
    SubClass testSubClass = new SubClass();
    If you're still at a loss, just remember: "Constructors aren't copy-pasted down from the superclass into the subclass!" and "Default constructors aren't added in if you add your own constructor in" :)
    To get it to work, you'd have to add the constructor you used in main to SubClass (like doopsterus did with inheritedClass), or use the constructor you defined in SubClass for when you make a new one in main:
    inherit2 obj = new inherit2(3,4);
    Hope that cleared things up further, if needed. By the way, you should consider naming your classes as a NounStartingWithACapital, and only methods as a verbStartingWithALowercase

  • Question about inheritance

    I'm attempting to write Monopoly and I'm having some inheritance problems. Every space on the board is first and foremost of type BoardSpace however some of them are of type Property which extends BoardSpace and some are of type Chance/Community which also extend BoardSpace etc. Depending on what type of space it is something different happens. Right now heres how a couple of classes look. I'm having a problem where if I land on a space that doesn't define its own action method, it defaults to the BoardSpace action method as it should yet it goes into that if statement even when it clearly shouldn't be. Like if I land in jail, it will still go into that if statement, and it will print Jail (3 times). Is this something funky with inheritance?
    BoardSpace:
    public class BoardSpace extends JPanel
         Location loc;
         String name;
         public BoardSpace(String s, Location l)
              loc = l;
              name = s;
         public void action(Player p)
              if(name.equals("Go"));//If name is "go" how can it also be "jail" ?
                   System.out.println(name);
                   System.out.println(this.name);
                   System.out.println(p.spot.name);
                   p.money+=200;
    }Property:
    import javax.swing.*;
    public class Property extends BoardSpace
         Player owner = null;
         public Property(String s, Location l)
              super(s,l);
         public void action(Player p)
              if(owner!=null && owner!=p)
                   JOptionPane.showMessageDialog(this,"You landed on "+this.name+".\n This property is owned by Player" +owner.number+".\n You owe $5");
              else
                   JOptionPane.showInputDialog("Buy?");
    }

    duckbill wrote:
    Hint: you can launch JOptionPane dialogs without a single panel, frame etc...
    #You can also launch dialogs with panels, frames, etc... but without subclassing Property from JPanel
    Edited by: DrLaszloJamf on Oct 3, 2007 12:42 PM

  • Dynamic table generation, an OOP question, and .

    I am attempting to teach myself Java using the Sun tutorials (mostly DiveLog) and these forums. So far, things are going well.
    My application is a scheduling program for my current boss. I work in retail, and the app would (ideally) faciliate creating the weekly schedules. I am using Swing to generate the windows and such.
    There are two main parts to the app, each corresponding to a tabbed pane. The first part will be a table with the employees listed down the left, the days of the week across the top, and with each cell being that employee's shift for the day. Totals for hours worked that week will be the farmost right column and totals for hours of coverage that day will be the bottom row. The second part of the app allows the user to enter in a new employee or display/edit an existing employee's information, including a list of scheduling constraints (e.g., can't work mornings Tu/Th because of class).
    My intuition is that the schedule table and the list of scheduling constraints should be dynamically generated and displayed depending on the number of employees and the number of constraints. It would also seem that both parts of the application need access to the current set of data encompassing all employees and their information. As I am just starting, the work I have done so far has been in the employee info section where I am in the process of implementing an MVC architecture with the model as a sort of employee datagram.
    The questions....
    1. How do I draw tables with a dynamic number of rows? I want the scheduler table to have a row for each employee and have the number of employees not hardcoded in. With the list of scheduling constraints, could I just have Swing draw each new row from a loop that counts down the number of constraints?
    2. What is the smart move regarding having multiple parts of the app/GUI access employee data? Would I just load the data into an object when the app starts and have the two parts access the info via 'get' functions? (And subsequently have the second part of the app be able to edit the data via 'set' functions and then tell the first part of the app update itself?)
    3. Is it appropriate to use reading and writing to and from a file for this sort of activity? (As opposed to a database of some sort.) The DiveLog app uses object serialization, and I'm feeling sketchy in this area, particularly with accessing specific pieces of data from whatever gets read from a file. If the user selects an employee from a JComboBox, how do I take that selection and grab the right object from the stuff that's been read back from a file? Similarly with the scheduling table.

    Hi,
    I am new to Jave programming. As a first step of learning, I want to do a Automated Employee Schedule Project in Java. (JSP)
    Could you please help me to understand the flow for creating Automated Employee Schedule project?
    Thanks in advance.
    Amitava

  • Question involving PDF's on Stock Paper

    Hi, I'm hoping someone could answer this question for me.  We are currently implementing LiveCycle ES and a designer template to replace an existing process.  Our current process produces Postscript files, we then add media calls to the postscript files for our highspeed printer center. 
    The postscript commands look like this:  <</MediaColor(white)/MediaType(2010StockNotice)>>setpagedevice
    My question is, is there a way to do this in PDF using LiveCycle Designer templates?
    Would this possibly be done in LiveCycle Output?  via an XDC file?
    NOTE:  It's more than just saying page 1 is to be printed from Paper tray 1, Page 2 on Paper tray 2 etc.  It's the actual Media type name so that our highspeed print center knows which stock to load.
    Thanks,
    Terry

    Firstly,
    Thanks for answering my questions it's been helpful so far. 
    To rephrase my question... Is there a way in LiveCycle Designer to insert postscript commands (i.e. as metadata or somewhere else) which would be picked up during the printing?  Specifically the setpagedevice command?
    If the answer to the above question is no, then is the alternative solution to have LiveCycle Output generate a postscript file then specify an XDC file which has the media type specified in it? 
    My preference is to implement the LiveCycle Designer solution if its possible. 
    Thanks,
    Terry

  • Question regd Inheritance. Please read

    In Inheritance,when a subclass extends a Superclass,
    the subclass is a specialized version of the superclass.Right?
    class B extends A{
    So,B is a specialized version of A.
    Supposing that class B also implements an Interface:
    class B extends A implements iFace{
    So now:
    Is B a specialized version of class A or a specialized version of an interface?
    Please can anyone answer?

    nope ist not a specialization od the interface. there right terminus would be class A is an implementation of the interface.
    interfaces have no behavoir, the are more sort of a method template which has to be implemented by another class. so something that has no behavoit cannot be specialized.

  • OOP Question

    Hoping someone can help. I've been introducing myself to OOP
    in Flash and have an issue. I've written a custom PreLoader class
    using MovieClipLoader and a Listener object. The code produces a
    good result but it seems that I am forced to use _root to reference
    properties inside two of my functions. If someone has experience
    with this I will send you the files and a bit more explanation. The
    class code is attached. Thanks in advance...

    Inside callback handlers (example in your class:
    listener.onLoadProgress) the class members go out of scope. There
    are several ways to solve this. One is to use a local (local to the
    function) variable that holds a reference to the current object.
    public function PreLoader(target:MovieClip) {
    var thisObj:PreLoader=this;
    and inside the callback handler access the class members:
    thisObj.mcFiller =
    Another way is to use the Delegate Class (hit F1 and search
    for Delegate). But, in this case where you use the MovieClipLoader
    Class you can solve it simply by using the events from the
    MovieClipLoader. You use an object as a listener for the events
    so... use the current object. See attached class.

Maybe you are looking for