Inheritance Constructor error

Hi guys, having a spot of bother with a constructor of a sub-class.
What i am doing is making a super class... Person and a subclass... Administrator
When i am coding my constructor for the administrator every inherited field constructs but my local one does not
The error i get is on the constructor parameter, Cannot find symbol : constructor Person. class: Person
I think it may be something to do with java not knowing what constructor to use
Heres my code
Personpublic abstract class Person{
    // TO DO
    // READ THE COMMENTS AND COMPLETE
    //Attributes
   public String name;
   public String address;
   public String sex;
   public int age;
       public Person(String name, String address, String sex, int age) {
        this.name = name;
        this.address = address;
        this.sex = sex;
        this.age = age;
    }Administrator
public class Administrator extends Person {
    // Attributes
    private String type;
    // TO DO
    // READ THE COMMENTS AND COMPLETE
     * Constructor
     * @param name name of the administrator
     * @param address address of the administrator
     * @param gender sex of the administrator
     * @param age age of the administrator
     * @param type member type of the administrator
    public Administrator(String name, String address, String gender,
            int age, String type) {
        this.name=name;
        this.address=address;
        this.sex= gender;
        this.age=age;
        this.type=type;
    }

If you don't explicity invoke a super constructor, the compiler inserts a call to the no-arg c'tor: super(); If your parent class does not have such a c'tor, that's an error. You'll need to add a call to
super(name, age, gender);
// or whatever parameters the parent's c'tor actually takesas the first line of your child class c'tor.

Similar Messages

  • CSS INHERITED TAG ERROR

    I am having an line through my css item and it is telling me that I have a css inherited tag error. I don't know what that means.
    I am not sure why espically because all I am doing is changing the image from one to another but when I try to relink the image it goes to a blank page and doesn't display the new image.
    I will post my css and my html code but also the url to the site is www.unicornforwriters.com ( the template I am referring to access' the services tab)
    any help would be appreciated.
    thank you
    CSS
    @charset "utf-8";
    .Containter {
        height: auto;
        width: 1000px;
        margin: 0 auto;
        background-image: url(../images/New_backgroud_servicespage.tif);
    .Containter #Header {
        background-image: url(../images/Page1/logo.jpg);
        background-repeat: no-repeat;
        position: relative;
        height: 82px;
        width: 1000px;
    #Main_content {
        font-family: Verdana, Geneva, sans-serif;
        background-image: url(../images/New_backgroud_servicespage.tif);
        background-repeat: no-repeat;
        height: 750px;
        width: 1000px;
    #Menu_horizontal {
        width: 1000px;
        background-image: url(../images/menubar_background%20Image.png);
        background-repeat: no-repeat;
    #left_maincontent {
        float: left;
        height: 620px;
        width: 430px;
        margin-top: 80px;
        margin-right: 5px;
        margin-bottom: 10px;
        margin-left: 80px;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
    #right_maincontent {
        float: right;
        height: 620px;
        width: 430px;
        margin-top: 80px;
        margin-right: 50px;
        margin-bottom: 10px;
        margin-left: 0px;
        font-size: 12px;
        font-family: Arial, Helvetica, sans-serif;
        color: #000;
        text-align: center;
    #left_image_wrap{
        margin: 20px;
        }.Containter #Main_content #right_maincontent p_header {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 18px;
        text-align: center;
        vertical-align: middle;
    .rightmain_header {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 24px;
        text-align: center;
    HTML
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Untitled Document</title>
    <!-- TemplateEndEditable -->
    <link href="../css/CSS_Main.css" rel="stylesheet" type="text/css" />
    <!-- Start css3menu.com HEAD section -->
    <!-- End css3menu.com HEAD section -->
    <!-- TemplateBeginEditable name="head" -->
    <!-- TemplateEndEditable -->
    <style type="text/css">
    #forwardright {
        position:absolute;
        left:976px;
        top:789px;
        width:55px;
        height:59px;
        z-index:1000;
        background-image: url(../images/unicorn_page_right.jpg);
        background-repeat:no-repeat;
    #forwardleft {
        position:absolute;
        left:36px;
        top:793px;
        width:50px;
        height:56px;
        z-index:1001;
        background-image: url(../images/unicorn_page_left.jpg);
        background-repeat:no-repeat;
    </style>
    <link href="../css/MenubarCSS.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="forwardright"></div>
    <div id="forwardleft"></div>
    <div class="Containter">
      <div id="Header"></div>
    <div id="Menu_horizontal">
    <!-- Start css3menu.com BODY section id=1 -->
    <ul id="css3menu1" class="topmenu">
        <li class="topfirst"><a href="../Pages/Home.htm" style="height:18px;line-height:18px;">Home</a></li>
        <li class="topmenu"><a href="../Pages/About_us.html" style="height:18px;line-height:18px;">About</a></li>
        <li class="topmenu"><a href="../Pages/Services_main.html" style="height:18px;line-height:18px;">Services</a></li>
        <li class="topmenu"><a href="../Pages/Fee_Sheet.html" style="height:18px;line-height:18px;">Fees</a></li>
        <li class="topmenu"><a href="../Pages/Events.html" style="height:18px;line-height:18px;">Events</a></li>
        <li class="topmenu"><a href="../Pages/Resources.html" style="height:18px;line-height:18px;">Resources</a></li>
        <li class="topmenu"><a href="http://www.unicornwritersconference.com/" style="height:18px;line-height:18px;">Conference</a></li>
        <li class="topmenu"><a href="http://www.jankardys.com/BlackHawk_Literary_Agency.html" style="height:18px;line-height:18px;">Literary Agency</a></li>
        <li class="toplast"><a href="../Pages/Contact_us.html" style="height:18px;line-height:18px;">Contact</a></li>
        <li class="toplast"><a href="#" style="height:18px;line-height:18px;">Links</a></li>
    </ul>
    <p style="display:none"><a href="http://css3menu.com/">Horizontal Menu Using CSS Css3Menu.com</a></p>
    <!-- End css3menu.com BODY section -->
    </div>
    <div id="Main_content">
    <!-- TemplateBeginEditable name="Editable_leftmaincontent" -->
      <div id="left_maincontent">
        <div id="left_image_wrap" align="center"><img alt="" name="Left_page_image" width="400" height="32" align="middle" id="Left_page_image_wrap" style="background-color: #00FF66" /></div>
      </div>
    <!-- TemplateEndEditable -->
    <!-- TemplateBeginEditable name="EditRegion_rightmaincontent" -->
    <div id="right_maincontent">
    <div class="rightmain_header">
      <p>google</p>
    </div>
    <p>main paragraph content</p>
    <p> </p>
    <div id="right_maincontent2"></br>
      <a href="../Fee_Sheet.html">See Price List. </a></div>
    <p> </p>
    </div>
    <!-- TemplateEndEditable --></div>
    <div></div>
    <div id="Footer" style="font-size: 9px">This site was built by Techno Mage LLC.</div>
    </div>
    </body>
    </html>

    I don't understand your question at all.  You are talking about template but the link you have posted doesn't seem to be from a tempalte.
    However, when I go to your site, I get this image:
    Now ehen I click on the image I get this page:
    I then click on the Services tab, I get this:
    Now explain what image should be on this page?  Why do you say you get a blank page?
    You need to explain your question again and provide which image isn't loading!!  Post that image on these forums.  You will need to login to these forums to post your image otherwise it won't come at all.  It will be blank!!!!!  if this is what you mean!

  • Why aren't inherited constructors returned?

    Let's say I have an abstract class that defines a public constructor, and a different class that extends this abstract class. I'd like to use reflection to instantiate an object of the subclass using the constructor of the parent class. If this is possible to do in code, why is it not possible to do at run-time? (Or am I hopefully missing something, and there is in fact a way to do this?) If Class.getMethods() will return inherited methods, why won't Class.getConstructors() return inherited constructors?

    Let's say I have an abstract class that defines a
    public constructor, and a different class that extends
    this abstract class. I'd like to use reflection to
    instantiate an object of the subclass using the
    constructor of the parent class. If this is possible
    to do in code, It's not possible to do it "in code" (by which I assume you mean the "normal" way, without reflection). As the other poster said, constructors are not inherited.
    If you're specifically interested in reflection, the following may not be particularly applicable to your current problem. However, you'll need to understand these rules anyway...
    Here are the rules for constructors--"ctors" because I'm lazy. Also, because I'm lazy, "super(...)" and "this(...)" mean any super or this call, regardless of how many args it takes, including those that take no args.
    1) Every class has at least one ctor.
    1.1) If you do not define an explicit constructor for your class, the compiler provides a implicit constructor that takes no args and simply calls super().
    1.2) If you do define one or more explicit constructors, regardless of whether they take args, then the compiler no longer provides the implicit no-arg ctor. In this case, you must explicitly define a public MyClass() {...} if you want one.
    1.3) Constructors are not inherited.
    2) The first statement in the body of any ctor is either a call to a superclass ctor super(...) or a call to another ctor of this class this(...) 2.1) If you do not explicitly put a call to super(...) or this(...) as the first statement in a ctor that you define, then the compiler implicitly inserts a call to super's no-arg ctor super() as the first call. The implicitly called ctor is always super's no-arg ctor, regardless of whether the currently running ctor takes args.
    2.2) There is always exactly one call to either super(...) or this(...) in each constructor, and it is always the first call. You can't put in more than one, and if you put one in, the compiler's implicitly provided one is removed.

  • Activatable object must provide an activation constructor error

    Hi everybody,
    while I'm trying to calling a simple activatable object, I got this error
    rmi://localhost:1099/MyActivatableServer
    Found a reference to the object that extend IMyRemoteInterface and Activatable
    Invoking the remote method of this object
    RemoteException
    java.rmi.activation.ActivateFailedException: activation failed; nested exception is:
         java.rmi.activation.ActivationException: Activatable object must provide an activation constructor; nested exception is:
         java.lang.NoSuchMethodException: Progetto3.MyActivatableServer.<init>(java.rmi.activation.ActivationID, java.rmi.MarshalledObject)
         at sun.rmi.server.ActivatableRef.activate(ActivatableRef.java:285)
         at sun.rmi.server.ActivatableRef.invoke(ActivatableRef.java:114)
         at Progetto3.MyActivatableServer_Stub.chiamamiInRemoto(Unknown Source)
         at Progetto3.Client.run(Client.java:52)
         at Progetto3.Client.main(Client.java:78)
    Caused by: java.rmi.activation.ActivationException: Activatable object must provide an activation constructor; nested exception is:
         java.lang.NoSuchMethodException: Progetto3.MyActivatableServer.<init>(java.rmi.activation.ActivationID, java.rmi.MarshalledObject)
         at sun.rmi.server.ActivationGroupImpl.newInstance(ActivationGroupImpl.java:273)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
         at sun.rmi.transport.Transport$1.run(Transport.java:153)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:595)
         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
         at java.rmi.activation.ActivationGroup_Stub.newInstance(Unknown Source)
         at sun.rmi.server.Activation$ObjectEntry.activate(Activation.java:1277)
         at sun.rmi.server.Activation$GroupEntry.activate(Activation.java:972)
         at sun.rmi.server.Activation$ActivatorImpl.activate(Activation.java:243)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
         at sun.rmi.transport.Transport$1.run(Transport.java:153)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:595)
         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
         at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
         at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
         at $Proxy0.activate(Unknown Source)
         at java.rmi.activation.ActivationID.activate(ActivationID.java:96)
         at sun.rmi.server.ActivatableRef.activate(ActivatableRef.java:258)
         ... 4 more
    Caused by: java.lang.NoSuchMethodException: Progetto3.MyActivatableServer.<init>(java.rmi.activation.ActivationID, java.rmi.MarshalledObject)
         at java.lang.Class.getConstructor0(Class.java:2647)
         at java.lang.Class.getDeclaredConstructor(Class.java:1953)
         at sun.rmi.server.ActivationGroupImpl$1.run(ActivationGroupImpl.java:228)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.server.ActivationGroupImpl.newInstance(ActivationGroupImpl.java:222)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
         at sun.rmi.transport.Transport$1.run(Transport.java:153)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:595)
    I can't figure out what constructor it need, because there is already a default constructor in the remote object implementation.
    do anybody have an idea?
    I'm going to post the program code in the reply.

    here is the client code
    public class Client implements Runnable {
         private String server;
         private long ms;
         private String msg;
         public Client(String server, long ms, String msg) {
              //server address
              this.server = server;
              //time in ms need for the activatable object
              this.ms = ms;
              //the message to print out
              this.msg = msg;
              public void run() {
              //create a securitymanager
              System.setSecurityManager(new RMISecurityManager());
             try {
                   String location = "rmi://" + server + "/MyActivatableServer";
                   System.out.println(location);
                   //lookup on server
                   IMyRemoteInterface mri = (IMyRemoteInterface)Naming.lookup(location);
                   System.out.println("Found a reference to the object that extend IMyRemoteInterface and Activatable ");
                   int risultato = 0;
                   System.out.println("Invoking the remote method of this object");
                    //call the method "chiamamiInRemoto" of the remote activatable object
                   risultato = mri.chiamamiInRemoto(ms, msg);
                   System.out.println("Fine dell'invocazione remota");
                   if (risultato != 0)
                        System.out.println("ok");
                   else
                        System.out.println("no ok");
              } catch (MalformedURLException e) {
                   System.out.println("MalformedUrlException");
                   e.printStackTrace();
              } catch (RemoteException e) {
                   System.out.println("RemoteException");
                   e.printStackTrace();
              } catch (NotBoundException e) {
                   System.out.println("NotBoundException");
                   e.printStackTrace();
              } catch (AccessControlException e){
                   System.out.println("AccessControlException");
                   e.printStackTrace();
              } catch (Exception e){
                   System.out.println("Other Exception");
                   e.printStackTrace();
         public static void main(String[] args) {
              Client cliente = new Client("localhost:1099",150,"hello");
              cliente.run();
    }the server interface that the activatable implements is simply
    public interface IMyRemoteInterface extends Remote {
         public int chiamamiInRemoto(long ms, String msg) throws RemoteException;
    }and the activatable object's implementation is
    public class MyActivatableServer extends Activatable implements IMyRemoteInterface {
         //il threadpool per gestire le chiamate arrivate
         private final ExecutorService pool;
         //per accedere al variabile indice, bisogna prima sincronizzarsi su questo lock
         private Object objLock;
         //un indice che tiene conto di quanti thread sono stati creati per gestire l'invocazione del client
         private int indice;
         public MyActivatableServer(ActivationID id, int data)
                   throws RemoteException {
              super(id, data);
              objLock = new Object();
              indice = 1;
              //il pool creato � di tipo CachedThreadPool, che aggiunge un nuovo thread al pool
              //nel caso in cui i thread presenti non siano disponibili per una nuova chiamata.
              pool = Executors.newCachedThreadPool();
         public int chiamamiInRemoto(long ms, String msg)
              throws RemoteException {
    //doing something here and return an Integer number
    }the setup java file is
    public class MyActivatableServerSetup {
         public static void main(String[] args) {
              System.setSecurityManager(new RMISecurityManager());
              //create an instance of ActivationGroup
              Properties props = new Properties();
              props.put("java.security.policy","d:\\policy");
              System.out.println(props.getProperty("java.security.policy"));
              ActivationGroupDesc.CommandEnvironment ace = null;
              ActivationGroupDesc ActivationGruppo = new ActivationGroupDesc(props, ace);
              try {
                   //registration
                   ActivationGroupID agID = ActivationGroup.getSystem().registerGroup(ActivationGruppo);
                   //location define l'URL where class are
                   String location = "file:///d:\\progetti\\Progetto\\bin\\";
                   //Other parameters need for the constructor of ActivationDesc
                   MarshalledObject data = null;
                   ActivationDesc desc = new ActivationDesc(agID,"Progetto3.MyActivatableServer",location,data);
                   //Registration to rmid
                   IMyRemoteInterface mri = (IMyRemoteInterface)Activatable.register(desc);
                   System.out.println("obtain stub for MyActivatableServer");
                   //Bind the stub
                   Naming.rebind("MyActivatableServer", mri);
                   System.out.println("Esportato MyActivatableServer");
              } catch (RemoteException e) {
                   System.out.println("RemoteException al Setup");
                   e.printStackTrace();
              } catch (UnknownGroupException e) {
                   System.out.println("UnknownGroupException al Setup");
                   e.printStackTrace();
              } catch (MalformedURLException e) {
                   System.out.println("MalformedURLException al Setup");
                   e.printStackTrace();
              } catch (ActivationException e) {
                   System.out.println("ActivationException al Setup");
                   e.printStackTrace();
              System.exit(0);
    }I can start the rmiregistry and rmid without problem, I can't esecute the setup of activatable object without problem, but when I try esecuting the client, the activation constructor error appear.
    I really can't figure out what is this constructor, doesn't I already implemented in my activatableServer yet? with public MyActivatableServer(ActivationID id, int data)
                   throws RemoteException {thanks in advance for everybody.

  • Inheritance, constructor and error handling

    I always got problems while trying to call the constructor of a class inheriting from an other.
    I have a concrete problem that is, I think, easy to solve, but I dont find the answer.
    Here is my method that throws an exception:
    public void aMethod() throws MyException
         doSomething();
         if ( errorOccured )
              throw new MyException( "An error occured");
    ...And here is the code of MyException (and here is the error I think):
    public class MyException extends java.lang.Exception
    }When javacing the class containing the first bloc of code I get something like:
    TheClass.java:103: cannot resolve symbol
    symbol  : constructor MyException  (java.lang.String)
    location: class MyException
                            throw new MyException( "An error occured" );
                                  ^If you know how to do that without error. Please give me codes, I will use them as example.
    Thx

    You are correct about where the error is. Although Exception has a constructor "new Exception(String)", if you create a subclass of Exception then you must define this constructor if you want to use it. Not difficult to do:
    public class MyException extends java.lang.Exception{
      public MyException(String s) {
        super(s);

  • Same script..works in one form but in another keep getting "Date is not a constructor" error.

    Using this javascript in one of my forms to timestamp it, (just a simple protected text field.)
    form1.MainPage.DateTimeStamp::docReady - (JavaScript, client)
    if (form1.MainPage.DateTimeStamp.rawValue == null) {
            var now = new Date();
            form1.MainPage.DateTimeStamp.rawValue = nowtoDateString() + now.toTimeString();
    This timestamps the form as it should.  The problem is on another form I'm building I'm using the identical script, (with different absolute paths of course,) and I keep getting a javascript error about date not being a constructor.  I've type the script in ten bajillion times and I'm at a loss for what is causing this.
    All I want is a simpel javascrip where I can display the time/date from the users system in a text field.

    Hi,
    You are missing a . inbetween "now" and "toDateString()"
    Also you can simplify the script as it is in the docReady of the textfield:
    if (this.rawValue == null)
         var now = new Date();
         this.rawValue = now.toDateString() + " " + now.toTimeString();
    Hope tht helps,
    Niall
    Assure Dynamics

  • How to solve "code of constructor" error in webdynpro

    hi everyone,
    i had developed one application(1 poject)in webdynpro with more than 90models added to that..... approximately 90-100 webservices models to it.....and using single component controller.....as i cannot use EP, i am integrated all my views in single applicaiton in this project.... upto it worked fine... when the models become more... the following error is coming.....
    i could not solved it.........
    " The code of constructor InternalTreeComp(com.sap.tc.webdynpro.progmodel.gci.IGCIComponent) is exceeding the 65535 bytes limit     InternalTreeComp.java"
    could anybody help me out,,, in this....

    Hi Sunil,
       The error that you receive is because of a Java limitation regarding the size of the code a compiler can compile.
       This limitation enforces a 65536 byte limit per method.
       Since you are using the Eclipse compiler you are getting this informative error text. Note that this error is the same as javac's "offset too big" message.
       So in order to solve your problem, try breaking up your code into smaller parts.
    Regards,
    Satyajit.

  • Resolving a constructor error

    Ok I'm new at this java prog stuff but here's my dilema. I'm having trouble trying to get an object work. I'm using a test program to call up a method in another program but I'm having no luck trying to get the test program to compile. The first program compiles fine. Any help would be great. Here's my programs is anybody can spot what I'm doing wrong.
    Program #1:public class Stock
         { //declaring variables and method Stock
         private String Symbol;
         private String Name;
         private double PreviousClosingPrice;
         private double CurrentPrice;
         public Stock(String Symbol, String Name, double PreviousClosingPrice, double CurrentPrice){
         this.Symbol = Symbol;
         this.Name = Name;
         this.PreviousClosingPrice = PreviousClosingPrice;
         this.CurrentPrice = CurrentPrice;
    public String getSymbol(){
         return Symbol;
    public void setSymbol (String Symbol){
         this.Symbol = Symbol;
    public String getName(){
         return Name;
    public void setName (String Name){
         this.Name = Name;
    public double getPreviousClosingPrice (){
         return PreviousClosingPrice;
    public void setPreviousClosingPrice (double PreviousClosingPrice) {
         this.PreviousClosingPrice = PreviousClosingPrice;
    public double getCurrentPrice (){
         return CurrentPrice;
    public void setCurrentPrice (double CurrentPrice)
         this.CurrentPrice = CurrentPrice;
         } //this method will calculate percentage diffenrence of stock from the previous day
    public double ChangePercent ()
         double ChangePercent;
         ChangePercent = (CurrentPrice - PreviousClosingPrice)/PreviousClosingPrice * 100;
         return ChangePercent;
    Program #2
    public class TestStock
    public static void main (String [] args)
         String Symbol = "NYIT";
         String Name = "New York Institute of Technology";
         double PreviousClosingPrice = 100.00;
         double CurrentPrice;
         System.out.println ("What is " + Symbol + " - " + Name + " current price?");
         CurrentPrice = DataInput.readDouble ();
         Stock stock = new Stock();
         stock.setSymbol (Symbol);
         stock.setName (Name);
         stock.setPreviousClosingPrice (PreviousClosingPrice);
         stock.setCurrentPrice (CurrentPrice);
         System.out.println ("The change of stock " + Symbol + " - " + Name + " is " + stock.ChangePercent () + "% from the yesterday closing price of $" + PreviousClosingPrice + ".");

    Stock stock = new Stock();The error message referred to this line, didn't it? Your Stock class doesn't have a constructor defined this way, with no parameters. But that is not Stock's problem, I think you should have writtenStock stock = new Stock(Symbol, Name, PreviousClosingPrice, CurrentPrice);and omitted the four lines of code following.

  • Photoshop CC x64 Constructor Error

    I recently upgraded from Photoshop CS6 to CC. When I try to run the Image Processor script on PS CC x64 I get the following error message -
    Reference Error: Windows dows not have a constructor: 325
    The Image Processor script will not run.
    The odd thing is that if I switch to PS CC x86 the same script will run just fine.
    Does anyone have an idea as to what is going on.
    Thanks

    I understand.
    You might only need to uninstall Photoshop and reinstall; assuming you don't use the Photoshop Creative Cloud Removal tool (which is very aggressive), plug-in software should not be touched by a simple uninstall / reinstall.
    It's also possible one of your plug-ins isn't compatible with Photoshop CC 14.1.2.  Have you tried running without the plug-ins?  You can start Photoshop temporarily without 3rd party plug-ins by holding down the Shift key while cold-starting Photoshop.
    -Noel

  • TargetFramework and inherits reference errors

    Since upgrading from Crystal Reports Distributable and CR2008 for VS2010 beta (version 14) to the final release (version 13), and redeploying my application, I am getting the following errors when I navigate to the website.  (Note that the application runs perfectly in the development environment).
    On the default aspx page - which is just a menu of hyperlinks, no viewer component - I get an Web.config error indicating that the targetFramework directive is not recognized, and I have to change:
    <compiltion debug="false" strict="false" explicit="true" targetFramework="4.0">
    to
    <compiltion debug="false" strict="false" explicit="true">
    Then the default page runs perfectly, but the subsequent viewer page reports "Could not load the assembly 'App_Web_u1d2wxho'. Make sure that it is compiled before accessing the page." The page will load if I remove the inherits tags, changing:
    <%@ page language="VB" autoeventwireup="false" inherits="_Default, App_Web_u1d2wxho" %>
    to
    <%@ page language="VB" autoeventwireup="false" %>
    But when it loads, the Crystal Report Viewer is completely blank - apparently the report requested on the menu page is not being loaded into the viewer.
    Any insights?  Thanks in advance.

    Many thanks for creating a new thread on this issue. Just organizes the forums a bit and helps in searching, etc.
    Anyhow, to the issue at hand. I have no idea what those error messages mean or why they are being thrown. But, let's glaze over the error messages for now and see how I'd go about deploying the app - perhaps there is something missing on your end.
    1) Before we install the CR runtime, we want to make sure we have the correct framework installed on the server
    2) If you are using .NET datasets, you will need framework 2.0 in addition to what ever framework your app uses
    3) You do not mention how you deployed the CR runtime, but this being a web app, I'd use the MSI. Again, we must use the correct MSI:
    32 bit:
    http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_redist_install_32bit_13_0.zip
    64 bit:
    http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_redist_install_64bit_13_0.zip
    The "bit" applies to the app, not the OS. E.g.; if the app is 32 bit and will run on a 64 bit OS, we need to install the 32 bit runtime.
    4) If this is a 64 bit OS, and the app is 32 bit, the IE will have to run in 32 bit mode
    5) If the app is in a default app pool, then all is good.
    6) If the app is running under custom app pool, the CR viewer directory will not be correctly configured and you will have to do this manually as the MSI has no idea about what app pool the app will run under. Thus if you are using custom app pool, you'll have to copy the ...\aspnet_client folder and it's subfolders from the dev box to the server and make sure it is copied under your app pool.
    - Ludek

  • Static Inheritance, Constructors --- Classes as objects

    First I asked myself why constructors are not inherited.
    Then I asked myself why Static Methods are not inherited.
    And it all seems to come down to, why Classes are not objects in Java as they are in Smalltalk?
    Is there any reason I'm missing?
    I would love at least inheritable static methods.

    That's OK, but that method would not be inherited, and would execute in the context of the superclass.
    Picture this (a simple "template method"):
    class SuperClass {
         public static void staticMethod() {          
              System.out.println("Static in SuperClass");
              other();          
         public static void other() {          
              System.out.println("other in SuperClass");
    class SubClass extends SuperClass{
         public static void other () {
              System.out.println("other in SubClass");
    Here, I just want to redefine other() in SubClass, but it calls the SuperClass version.
    Let's test:
    public class Test {
         public static void main(String[] args) throws DatabaseErrorException, TableUpdateException {
              SuperClass.staticMethod();
              SubClass.staticMethod();
    Output:
    Static in SuperClass
    other in SuperClass
    Static in SuperClass
    other in SuperClass
    First line calls static in SuperClass, which calls other (found in SuperClass and executed), the output from other is second line.
    Then, the third line shows calling staticMehod in SubClass, which doesn't redefine it, and executes the SuperClass version, that's ok, but when staticMethod calls other, it doesn't look for it in SubClass, but it directly executes the one in SuperClass (which is shown in line 4).

  • Inheritance constructor question

    Hi
    I am having trouble understanding how the superclasses constructor works in inheritance:
    Please look at the following code:
    public class mySuperClass
         mySuperClass ()
              System.out.println("super1");
    public class myClass extends mySuperClass
         myClass ()
              System.out.println("hello1");
         myClass (int q)
              System.out.println("hello2");
    public static void main(String[] args)
              myClass o = new myClass ();
              myClass o = new myClass (3);
    When I run this program the console results are:
    super1
    hello1
    super1
    hello2
    Why does the constructor of the super class run even when I overload it?
    Thanks
    Aharon

    I think you meant to write "Why does the constructor of the super class run even when I overrideit?"
    And the point is you can't override a constructor (technically, they are not even methods). A constructor in a derived class (MyClass) must call a constructor in its superclass (MySuperClass ). If you do not explicitly call one:
    MyClass (int q) {
        super(...arguments...); // <---
        System.out.println("hello2");
    }There will be an attempt to implicitly to invoke super();

  • Constructor-Error for Property()

    Hello,
    i am facing a strange problem.
    According to the API a possible constructor for com.sapportals.wcm.repository.Property is:
    Property(IPropertyName name, java.lang.INTERGER value)
    This is also correct, when i check the coding within the jar. Within my NWDS i reference this jar, but within the NWDS i get the error message:
    "The constructor Property(IPropertyName, int) is undefined". So i cannot compile my code. Anyone has an idea how to solve this?
    regards,
    Marco

    If you look carefully its Integer and not int. so please create a Integer object from the primitive int data type and it should be OK then.

  • Java.sql.Timestamp: does not have a no-arg default constructor ERROR

    Hi,
    I am using jaxws(jwsdp2.0) and when i use the apt tool I get this error because I use java.sql.Timestamp as one of the fields in a class. What is the workaround for this problem? Any help is appreciated.
    Thanks,
    Vijay

    I just replaced java.sql.Timestamp to java.util.Date for this to work.
    Any other workaround is welcome.
    Vijay

  • Catching exception from inherited constructor

    Hi all,
    If I'm extending a class and the constructor of the parent class throws an exception, is there any way to catch that exception in my constructor? What I would like to do is something like this.
    public class MyClass extends OtherClass {    // the constructor for OtherClass throws an exception
        public MyClass() {
            try {
                super();
            } catch (Exception e) {}
    }But of course you can't do that because super() has to be the first command in the method. Is there any other way to accomplish this? My objective is to chain this exception to a different type of exception.

    Write a factory method? For example:
    class ABCException extends Exception {}
    class XYZException extends Exception {}
    class OtherClass {
        public OtherClass()  throws ABCException {
            throw new ABCException();
    class MyClass extends OtherClass {    // the constructor for OtherClass throws an exception
        protected MyClass() throws ABCException {
           super();
        public static MyClass instance() throws XYZException {
            try {
                return new MyClass();
            } catch (ABCException e) {
                throw new XYZException();
    }

Maybe you are looking for