Constructor with no parameters

Greetings,
What is a constructor with no parameters?
Just started on my new lab today and most of its going pretty good. Except I can't get the compiler to go past the first part...which pretty much hangs up the rest. My instructions are to create a constructor with no parameters, and after doing some research I thought I did that. Would someone mind taking at look at this and help me understand what I'm not doing? Thanks.
I'm only suppose to use the three variables that I've already put in, but the first constructor doesn't want to use any of those.
public class Time
    // instance variables
    private int hour;
    private int minutes;
    private int seconds;
     * Default constructor for objects of class Time.
    public Time()
        Time();
    }

public class Time {
    private int hour;
    private int minutes;
    private int seconds;
    // no constructor typed
    public static void main(String[] args) {
        Time t1 = new Time();  // OK
        Time t2 = new Time(5, 5, 5); // error
}This is Ok for t1 because if you do not provide a default (no args) constructor, one will be supplied when it compiles.
public class Time {
    private int hour;
    private int minutes;
    private int seconds;
    public Time(int h, int m, int s) {
    public static void main(String[] args) {
        Time t1 = new Time();  // error
        Time t2 = new Time(5, 5, 5); // OK
}Now ok for t2 since you have provided a constrcutor but not ok for t1 as the default constructor will not be provided for you. Default constructor only provided if you do not provide one.
public class Time {
    private int hour;
    private int minutes;
    private int seconds;
    public Time() {}
    public Time(int h, int m, int s) {
    public static void main(String[] args) {
        Time t1 = new Time();  // OK
        Time t2 = new Time(5, 5, 5); // OK
}Now both t1 and t2 are ok since both constructors are been supplied.

Similar Messages

  • How to design constructor with variable parameters?

    I'm working on a "project" where I need to make a class "book" that can store information about a book. It's name, isbn, stock, etc... What is throwing me off a little bit is the author. I'm allowed to enter up to 4 authors per book object. I'm coming at the problem with the assumption, that I should be able to load this author data within the constructor. Questions is how. At first I thought I'd make 4 different constructors, each with a different number of author parameters. Simple enough but it seems unnecessarily messy. Then I thought I'd make a variable length parameter array. e.g book( String ... author ). But what if someone wants to enter more than 4 authors or none at all?
    QUESTION:
    Is there a way I can set a minimum and maximum of inputs for variable length paramters?
    Vectors seem like they could be useful here instead of arrays. But again there is that problem of controlling constructor parameters.

    Then I thought I'd make a variable length parameter array. e.g book( String ... author ). (Otherstuff, String author, String ... otherAuthors)
    Is there a way I can set a minimum and maximum of inputs for variable length paramters?Validate it in the code itself
    Or create another class specifically for Authors
    No matter what you do you will still need validation code, for example what if the author is null? Or empty?
         class Authors
                public String Author1;
                public String Author2;
                public String Author3;
                public String Author4;
                public Authors(String auth)
                public Authors(String auth1, String auth2)
           }

  • How to create default web service constructor with optional parameters in C#

    hi senior :)
    i tried to create a web services with a default constructor and another that takes few arguments, no matter
    what i do I couldn't call the non default constructor from the client! how can I pass my arguments in the constructor? worse yet, I tried to pass my arguments to another exposed WebMethod, guess what? the public or private variables i'm trying to update,
    do not get updated, what gives? any documentation on how to use web services? i'm pretty newbie at this. thanks

    http://forums.asp.net/
    You need to post to Web services section in the above forum.

  • Overriding constructors with static parameters?

    I have an abstract class named Stuk with the following constructor:
         public Stuk(boolean rdstuk, String soort){
              roodstuk = rdstuk;
         }and i have a couple of subclasses like this one:
    public Maarschalk(boolean rdstuk, soort){
              super(rdstuk, "maarschalk");
         }with soort being a static string that differs in every subclass
    i tried this because i want to be able to make an object of a certain subclass without making if-else constructions to make sure the proper constructor is used.
    ofcourse, the static variable method doesnt work
    any other suggestions?
    thanks in advance

    oh sorry i misposted the constructors
    code of the constructor of abstract class Stuk:
    public abstract class Stuk{
         /* instantievariabelen:
          private boolean roodstuk;
         public Stuk(boolean rdstuk,final String soort){
              roodstuk = rdstuk;
         }code of the constructor of subclass Maarschalk
    public class Maarschalk extends Stuk{
         private final static int level = 11;
         private final static Figuur f = StrategoMain.figuren.getFiguur("maarschalk").scaleer(StrategoBord.portretbreedte, StrategoBord.portrethoogte);
         private final static String soort = "maarschalk";
         /* CONSTRUCTOREN:
          *Maarschalk(boolean rdstuk, soort)
         public Maarschalk(boolean rdstuk,"maarschalk"){
              super(rdstuk, "maarschalk");
         }error when trying to compile Maarschalk:
    "illegal start of type"

  • Filter af:outputText  value with some parameters before loading component

    I use jdeveloper 10.1.3 with web adf components.
    I want to show outputText component with some custom Object (item),
    <af:outputText value="#{bindings.item}">
    but before showing this component on the page , during runtime, this item object must be filtered with some parameters and then returned some string ( convert item object to string with parameters during runtime, before loading this outputText component).
    How can I do this?
    Maybe it needs some back beans or I am thinking to create custom component like outputText ,but how to do ?
    what is optimal disizion?
    can someone help me or someone can send some documentation?

    Hi,
    When u will bind Output Text with some method in Backing bean u will get a set(),get() methods along with a CoreOutputText variable, u can initialized the variable , and if u want to check any condition then before setting the value then check the condition in the constructor of the backing bean and then change the CoreOutputText value accordingly,which will set the corresponding value,in the UI
    Thanks

  • How to write a SQL query in SAP B1 2007 B with input parameters?

    How to write a SQL query in SAP B1 2007 B with input parameters, on execution of which will ask for some input value from the user and the values will be selected from a list such as item list?

    The syntax like
    SELECT * FROM OITM T0 WHERE T0.ItemCode = '[%0\]'
    Thanks,
    Gordon

  • Running a SQL Stored Procedure from Power Query with Dynamic Parameters

    Hi,
    I want to execute a stored procedure from Power Query with dynamic parameters.
    In normal process, query will look like below in Power Query. Here the value 'Dileep' is passed as a parameter value to SP.
        Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData 'Dileep'"]
    Now I want to pass the value dynamically taking from excel sheet. I can get the required excel cell value in a variable but unable to pass it to query.
        Name_Parameter = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        Name_Value = Name_Parameter{0}[Value],
    I have tried like below but it is not working.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData Name_Value"]
    Can anyone please help me with this issue.
    Thanks
    Dileep

    Hi,
    I got it. Below is the correct syntax.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData '" & Name_Value & "'"]
    Thanks
    Dileep

  • How can I install Firefox SILENTLY in a specific installation folder, -ms with which parameters ?

    How can I install Firefox SILENTLY in a specific installation folder, -ms with which parameters ?
    "Firefox.exe_path" -ms OPTIONS ??
    Thanks.

    '''Is there a way to download FF to a USB from another computer and install it from that USB on my PC? '''
    You basically answered your own question. If you have access to another computer just go download the appropriate language and OS version of Firefox 5.0 from http://www.mozilla.com/en-US/firefox/all.html and put it on you usb drive and then go and install it onto you pc.

  • Error when using Analytic view with Input Parameters

    Hi,
    I am trying to create an info space based on my Analytic view which has input parameters. The infospace is validated and indexed without any issue. However when I ran the view, I get an error (50011) as it is unable to fetch any results. I tried using an infospace based on Calculation view with input parameters and the explorer view works without any issue.
    Has anyone faced similar issues?
    We are using HANA SP 6 rev 67 and BI 4.0 SP 4.
    Also is there a way to enable input prompts for the users when they refresh the BO Explorer view? If not currently available is there any work around ?
    Thanks

    Hello George,
    I don't have any personalization set on the info space. Also I am using mapped Account in BI to connect to HANA. The confusing part is that it is able to validate the infospace with the input parameters and index it. However query does not return any results. I even tried running the same query which explorer sends to HANA in the SQL editor and there too the same results,the query does not return anything. The model does return data when I do a data preview and if accessed from other tools like AAO.
    Also when I use SSO connection to HANA, indexing of the infospace fails. Where can I see the error log?
    Thanks,

  • How to schedule a report with dynamic parameters

    We need to schedule a Webi report with dynamic parameters then email the different result to different email groups.  Is it possible to do this in scheduler? Please advise. Thanks.

    there are 2 schedulers
    1st  CMS
    the reports which does not have any input parameters, only then t can be scheduled in CMS
    2nd in Infoview
    if report has input parameters and if you want to schedule it, then you may need to schedule the report from Infoview
    To have a email notification
    configure the SMTP server in report JOB Server
    Thanks,
    Ganesh

  • Calling a Stored Procedure with output parameters from Query Templates

    This is same problem which Shalaka Khandekar logged earlier. This new thread gives the complete description about our problem. Please go through this problem and suggest us a feasible solution.
    We encountered a problem while calling a stored procedure from MII Query Template as follows-
    1. Stored Procedure is defined in a package. Procedure takes the below inputs and outputs.
    a) Input1 - CLOB
    b) Input2 - CLOB
    c) Input3 - CLOB
    d) Output1 - CLOB
    e) Output2 - CLOB
    f) Output3 - Varchar2
    2. There are two ways to get the output back.
    a) Using a Stored Procedure by declaring necessary OUT parameters.
    b) Using a Function which returns a single value.
    3. Consider we are using method 2-a. To call a Stored Procedure with OUT parameters from the Query Template we need to declare variables of
    corresponding types and pass them to the Stored Procedure along with the necessary input parameters.
    4. This method is not a solution to get output because we cannot declare variables of some type(CLOB, Varchar2) in Query Template.
    5. Even though we are successful (step 4) in declaring the OUT variables in Query Template and passed it successfully to the procedure, but our procedure contains outputs which are of type CLOB. It means we are going to get data which is more than VARCHAR2 length which query template cannot return(Limit is 32767
    characters)
    6. So the method 2-a is ruled out.
    7. Now consider method 2-b. Function returns only one value, but we have 3 different OUT values. Assume that we have appended them using a separator. This value is going to be more than 32767 characters which is again a problem with the query template(refer to point 5). So option 2-b is also ruled out.
    Apart from above mentioned methods there is a work around. It is to create a temporary table in the database with above 3 OUT parameters along with a session specific column. We insert the output which we got from the procedure to the temporary table and use it further. As soon the usage of the data is completed we delete the current session specific data. So indirectly we call the table as a Session Table. This solution increases unnecessary load on the database.
    Thanks in Advance.
    Rajesh

    Rajesh,
    please check if this following proposal could serve you.
    Define the Query with mode FixedQueryWithOutput. In the package define a ref cursor as IN OUT parameter. To get your 3 values back, open the cursor in your procedure like "Select val1, val2, val3 from dual". Then the values should get into your query.
    Here is an example how this could be defined.
    Package:
    type return_cur IS ref CURSOR;
    Procedure:
    PROCEDURE myProc(myReturnCur IN OUT return_cur) ...
    OPEN myReturnCur FOR SELECT val1, val2, val3  FROM dual;
    Query:
    DECLARE
      MYRETURNCUR myPackage.return_cur;
    BEGIN
      myPackage.myProc(
        MYRETURNCUR => ?
    END;
    Good luck.
    Michael

  • "Source not found" Error creating URL Data control with query parameters

    Hi,
    I have a restful service for which i want to create a URL data control. I am able to create the URL data control successfully when i am not passing any parameters in the Source field. But if i am specifying the parameters in the source field like this Department=##ParamName##, something weird is happening. After giving the param string in the Source field, it asks for default param value to test the url. It tests the url successfully. After that i select XML as the data format in which i am mentioning the xsd like this . "file:///C:/..../something.xsd" . And this is when i am getting the error. "Invalid Connection. The source is not found". I am giving exactly same path for xsd which i gave while creating URL data control without query parameters. Infact i was able to create the URL data control with query parameters successfully till afternoon. after that it started giving me this error all of a sudden. Infact as soon as i was able to create a URL data contol with query parameter successfully, i took a backup of the application before moving further. But even that backup is not working now.
    As far as i understand, i dont think there will be any change in xsd if query params are passed to a web service. Please correct me if i am wrong.
    Just dont know what could be the issue. Please help
    Thanks

    Hi,
    xsd is used for the URL service to know what the returned data structure is so it can create the ADF DC metadata
    Frank

  • Calling stored procedure with output parameters in a different schema

    I have a simple stored procedure with two parameters:
    PROCEDURE Test1(
    pOutRecords OUT tCursorRef,
    pIdNumber IN NUMBER);
    where tCursorRef is REF CURSOR.
    (This procedure is part of a package with REF CURSOR declared in there)
    And I have two database schemas: AppOwner and AppUser.
    The above stored procedure is owned by AppOwner, but I have to execute this stored procedure from AppUser schema. I have created a private synonym and granted the neccessary privileges for AppUser schema to execute the package in the AppUser schema.
    When I ran the above procedure from VB using ADO and OraOLEDB.Oracle.1 driver, I got the following error when connecting to the AppUser schema:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'TEST1'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    but when I was connecting to the AppOwner schema, everything is running correctly without errors.
    Also, when I switch to the microsoft MSDAORA.1 driver, I can execute the above procedure without any problems even when connecting to the AppUser schema.
    I got this error only when I am trying to execute a stored procedure with an output parameter. All other procedures with only input parameters have no problems at all.
    Do you know the reason for that? Thanks!

    If anyone has figured this one out let me know. I'm getting the same problem. Only in my case I've tried both the "OraOLEDB.Oracle" provider and the "MSDAORA" provider and I get an error either way. Also my procedure has 2 in parameters and 1 out parameter. At least now I know I'm not the only one with this issue. :)
    '*** the Oracle procedure ***
    Create sp_getconfiguration(mygroup in varchar2, myparameter in varchar2, myvalue out varchar2)
    AS
    rec_config tblconfiguration.configvalue%type;
    cursor cur_config is select configvalue from tblconfiguration where configgroup = mygroup and configparameter = myparameter;
    begin
    open cur_config;
    fetch cur_config into rec_config;
    close cur_config;
    myvalue := rec_config;
    end;
    '** the ado code ****
    dim dbconn as new adodb.connection
    dim oCmd as new adodb.connection
    dim ors as new adodb.recordset
    dbconn.provider = "MSDAORA" 'or dbconn.provider = "OraOLEDB.Oracle"
    dbconn.open "Data Source=dahdah;User ID=didi;Password=humdy;PLSQLRSet=1;"
    set ocmd.activeconnection = dbconn
    cmd.commandtext = "{call fogle.sp_getconfiguration(?,?)}"
    'i've also tried creating a public synonym called getconfiguration and just refering to procedure by that.
    ' "{call getconfiguration(?, ?)}"
    ' "{call getconfiguration(?,?, {resultset 1, myvalue})}"
    'and numerous numerous other combinations
    set oPrm = cmd.createparameter("MYGROUP", advarchar, adparaminput, 50, strGrouptoPassIn$)
    cmd.parameters.append oPrm
    set oPrm = cmd.createParameter("MYPARAMETER", advarchar, adParamInput, 50, strParameterToPassIn$)
    cmdParameters.append oPrm
    set rs = cmd.execute

  • ABAP WebDynpro app calling Transaction iview with Dynamic Parameters..?

    Good day!
    I need to code a call to a transaction (with dynamic parameters) from an Abap WD application.  It appears that to achieve this, the app needs to call a new portal transaction iview, passing the parameters in the call..? 
    This should ideally be via a Sapgui for Windows, but Html also an option (does it matter with regards to the method used?). 
    Kindly assist with advise/instructions, idealy with sample code extract to illustrate (new to Abap WD)...
    Kind regards
    j

    Hi
    this will help you doing so
    http://help.sap.com/saphelp_nw04s/helpdata/en/18/f96f4132f15c58e10000000a1550b0/frameset.htm
    Use BUSINESS_PARAMETERS to pass the data
    Abhi

  • How to use Count with Date Parameters

    Hello,
    I am having issues using the Count() function in conjunction with date parameters.
    This is a Siebel report and in my report I have 2 date parameters(From Date, To Date). In a nutshell I am basically trying to count Opportunities that has a start date within the given date period. However I don't see a reasonable way to put my date parameters within the Count() function. The reason being is that I need to have a huge chunk of code to convert the dates into a common format that can be compared, and it won't even fit within the code block in my rtf template. I am not even sure how to put multiple conditional statements inside a Count() function since all the examples I have seen are very simple.
    Anyone have a suggestion on how to use Count() with date parameters?
    Thanks.

    Any chance you can get the date formats in the correct format from siebel?
    I don't know Siebel - so I can't help you with that. If you get the correct format it is just
    <?count(row[(FromDate>=date) and  (date<=ToDate))?>
    Otherwise the approach would probably need to use string function to get year/monthd/day from the date
    and store it into a varialbe and compare later the same way
    <?variable@incontext:from; ....?>
    <?variable@incontext:to; ...?>
    <?count(row[($from>=date) and  (date<=$to))?>
    Potentially you can use the date functions such as xdofx:to_date to do the conversion
    [http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm]
    But I am not sure if they are available in your siebel implementation.
    Hope that helps

Maybe you are looking for

  • Can't Open Some PDFs

    I have the most recent version of Adobe Reader and can't open/read some PDFs that I could open with OS10.6.

  • Restart after Audio Receiver is shut off

    Every time I shut off my Audio Receiver (Apple TV is connected to it via HDMI) I have to rest Apple TV the next time I turn it on. Any suggestions

  • Classroom in a Book question - Chapter 3

    Hi Everyone, I'm VERY new to InDesign and am trying to go through this on my own.  I'm working on chapter 3 in the book and for some reason, when I import the text file it asks for, the file moves my image at the bottom of the page to the next page. 

  • Setup Oracle monitoring with SNMP

    Hello, I don't understand why I can't read oracle MIB (.1.3.6.1.4.1.111 ). I have installed Oracle Entreprise manager and start it : --> emctl start dbconsole .... started. I have installed Oracle Management Agent and subagent. emctl start subagent -

  • I Can't see B580 Ram Info on Everest

    Hi, I've just bought a lenovo B580 Laptop(i5 3210 + 610M Graphic Card + 8GB Ram [4+4] ), and i wanted to check system details, device properties etc with Everest and Cpu-z. With these programs i can only see total ram size (8GB) but i cant see any in