Problem in creating new object in this code below

private Player owner;
private int armies;
public Territory(String name, Continent continent)
owner = new Player(Territory territory, Player owner); <============ ) is expected
I have an error following that code. It said that ")" is expected

our main error was territory class requires a continent object not an territory object
public class Continent
private String name;
private Territory territory1;
private Territory territory2;
public Continent(String name)
this.name = name;
territory1 = new Territory("Territory1", new Continent("Asia") ); // instead of territory1 use new Continent("Asia")
territory2 = new Territory(); // GIVE IT TWO PARAMETERS LIKE "territory 2" and new Continent("Asia")
Oh my bad, I means the territory2 = new Territory("Territory2", new Continent("Asia"); // it is same :D
but when I want to create territoty for Europe, I will do a repeating code like this in class Territory n our lecturer forbid it:
territory1 = new Territory("Territory1", new Continent("Asia")); //Pass an object as argument
territory2 = new Territory("Territory2", new Continent("Asia"));
territory1 = new Territory("Territory1", new Continent("Europe")); //Pass an object as argument
territory2 = new Territory("Territory2", new Continent("Europe"));
is there any other way to do it in single code? such as bring the objects in class World together
private Continent asia;
private Continent europe;
Continent asia = new Continent("Asia");
Continent europe = new Continent("Europe");
instead using new Continent("Asia") we use the object in class World pass it to class Continent and then from Continent pass them to Territory
like this:
territory1 = new Territory("Territory1", new Continent(name)); //Pass an object as argument
territory2 = new Territory("Territory2", new Continent(name));
since we has variable called String name, so we can just pass it whatever that is passed from class World
public class Continent
private String name;
private Territory territory1;
private Territory territory2;
public Continent(String name)
Thanks a lot in helping us, have a nice day.

Similar Messages

  • Problem in creating new objects in ABAP workbench

    Hi ,
        I am getting error in a newly installed SAP system when try to create new objects in ABAP workbench. The error is like'No changes for the user allowed'.
    Can you tell me what the error is here? What can be done for this so that I can create new object.
    Thanks,
    Manas

    Hi,
    Run tcode SU01. (Provided if u hav authorization to run this Tcode)
    Enter SAP* as user and click on the Copy button.
    Enter the name for your new user in the dialog box and click Continue
    Enter a password for your new user.
    Goto Profile sheet and adjust the profiles to be SAP_ALL and SAP_NEW.
    Save the user and logon with it.
    Now you'll be able to do your changes.
    Reward Points if useful.
    Regards
    Rose
    Edited by: Rose Preethi on Mar 31, 2008 5:20 PM

  • Problem when creating new Objects in ESR

    Hi ,
    When i am trying to create new objects in ESR it is no allowing me to do,i have developed around 80 interfaces as of nowmsuddenly this eeror i getting,anyone experienced this kind of issue.
    *You cannot create new objects since the system is not the original system of the software component version*
    You cannot create new objects since the system is not
    the original system of the software component version (NOT_ORIGINAL_NO_CREATE)
    MESSAGE ID: com.sap.aii.ib.server.oa.rb_all.NOT_ORIGINAL_NO_CREATE
    Regards,
    Raj

    Hi Raja,
    I am new to SAP PI. So i dunno much regarding SAP PI. Hence i am getting same error that not able to create objects in SWCV. I read this discussion but i dunno where to select the 'Modifiable & Original' options, so that i can enable the Objects. Can you please guide me?
    Thanks,
    Amarnath

  • Problems to create new object!

    Hello,
    I have a problem to create a new object in OracleLite 9i.
    I'm using okapi to do this, but the value of the numeric fields isn't the expected.
    In msql the field is number(10,0). I'm trying to insert a ok4B.
    Anybody can help me?

    I found the problem.
    It occurs when I use a number(x,y), where x &gt; 9 or Y &gt; 0.
    I made a workaround to solve this problem. This is simple, I just convert the field number to char in the Snapshot of the Wtgpack

  • Problem in creating new communication channel template in IR

    Hi experts,
    I currently have problems with creating new communication channel template in Integration Repository. If I choose the New-Context (Adapter Objects-->Communication Channel Template) the dialog "CREATE OBJECT" is shown. After I have inserted the Name of my template I push the create button.
    Then the following error occurs:
    STOP: Internal error: Object cannot be changed in display mode
    DETAILS: Internal error: Object cannot be changed in display mode(CANT_SET_MODIFIED).
    So can anybody help me. Thanks for your help.
    Best regards.
    Mario

    Hi Mario,
                This is genral problem appearing in PI 7.0 with SP12.
                Previously, i have the same problem.
                i.e STOP: Internal error: Object cannot be changed in display mode
    DETAILS: Internal error: Object cannot be changed in display mode(CANT_SET_MODIFIED)
                Regarding this we raise an OSS note SAP people.
                they gave the suggestion that update with SP13.
              i discuss with basis team and install the SP13.
               now the problem is solved, i can able to create the Communication Channel Template.
    Please award points, if it really help to u
    Regards
    Mahesh.

  • Problem with creating new user in portal = portlet is not visible

    Hi,
    I've got a problem with creating new users in portal. In the Administer tab of the builder is the user portlet not visible.
    How can I make this portlet visible?
    Please Help
    thank you...
    Gilbert

    Hi..my problem slightly similar.
    I created one new user, and didn't select anything from "Public Groups Assignment" and "Privilege Assignment" for him.
    I expect the user will be a public user.
    But, when he try to logged in the portal,
    He cannot see all the PORTLETS related to database values..
    All he can see just LINKS -that all in my portal right now beside the report from database that the user cannot see :)
    So, what did i do wrong?
    Plz Advise, and thanks.

  • Problem in creating new versions for existing DIR using CV01N

    I am working in SAP ERP 6.0 EHP 4.0 system.
    I have problem in creating new versions for existing DIR using CV01N
    I create a DIR version 00 with functional location and mpd cycles. Then when i try to create a new version by copying the contents created from already created document.I change the MPD cycles in the new version and save it.
    once when i display the first document created the mpdcycle specified in version 01 is copied to the 00 version.
    The document is inconsistent where versioning of document doesnot work properly wrt MPDCYCLE and MP HEADER.
    The problem which i found was the document identification guid remains the same for all the document versions getting created.
    The same is working fine in SAP ERP6.0 EHP3.0 sytem.
    Please someone help me in resolving the above issue.
    Regards,
    Prasad.B

    There is a change in the standard code.The reason for the above problem was  because of a missing Enhancemnet point in a standard function module 'CV110_DOC_CREATE_WITH_TEMPLATE'.
    IS-ADEC-MPD  - Enhancement to copy MPD data
    ENHANCEMENT-POINT CV110_DOC_CREATE_WTEMPL_01 SPOTS ES_SAPLCV110.
    +*$*$-Start: CV110_DOC_CREATE_WTEMPL_01----------------------------------------------------------$*$*+
    +**ENHANCEMENT 1  ZSF_AD_MPD_SAPLCV110.    "active version**+
    +*** copy MPD relevant data from templ. doc to current doc**+
      +**CALL FUNCTION 'MPD02_COPY_MPD_DATA'**+
        +**EXPORTING**+
          +**is_draw = ls_draw**+
        +**TABLES**+
          +**ct_drad = lt_drad.**+
    +*ENDENHANCEMENT.**$*$-End:   CV110_DOC_CREATE_WTEMPL_01----------------------------------------------------------$*$*+
    Created a custom enhancement point similar to SAP ECC6.0 EHP 3.0 system.
    The reason was the buffer was not getting cleared previously.After inserting the above code the DIR's are getting created withot any issues.
    Regards,
    Prasad.B

  • How to create new object key in BDS?

    Hello,
    I need to create custom class in BDS (OT type) and object key for it.
    In this forum (and in the whole Internet) I found information only about custom class. However there's nothing about object key.
    How could I create new object key in BDS class?
    Great thanx in advance!

    Hi Max,
    you can create BOR object in business object repository, Transaction SWO1, SWO2, search documentaion for BOR obkect.
    Regards,
    Clemens

  • Resuse existing object (Sp,tables etc)or create new object if that is possible?

    Hello Everyone,
    Is it a good practice to create new objects (stored procedures, tables etc.) or modify and reuse the existing object if that can be done?
    Regards
    Regards

    If you need simple add a new column to the SELECT statement so there is no need to create a new stored procedure/view for this
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • What is the diffrence between extends and creating new object?

    HI ALL,
    what is the diffrence between extends and creating new object?
    meaning
    class base{
    class derived extends base{
    class base{
    class derived {
    derived(){
    base var = new base();
    can u people tell me diffence from the above examples.
    THANKS.
    ANANDA

    When you create a new object you have to supply the class to which that
    object belongs. A class can extend from another class. If it does so
    explicitly you can define the 'parent' class from which the class extends.
    If you don't explicitly mention anything, the class will implicitly extend
    from the absolute base class named 'Object'.
    Your example is a bit convoluted: when you create a Derived object,
    its constructor creates another object, i.e. an object from the class from
    which the Derived class extends.
    Extending from a class and creating an object don't have much in common.
    kind regards,
    Jos

  • Problem in creating new contact

    Hi friends,
    whenever i am creating a new contact it gets created, but the same time when i look at the contacts it is missing. simply, i am not able to create a new contact in my 5S
    Hope you could help me
    Thanks

    Hi jamilhamada,
    IF you are ready to welcome risks ??? My suggestion could be uninstall Nokia PC Suite (whatever version exists on your PC even if its latest), nokia connectivity cable driver, PC COnnectivity solution, Run reliable registry cleaner, install latest Nokia PC Suite 7.0.8.2 and reboot the PC and then connect your phone with the pc and open Nokia communication centre which is a part of Nokia pc suite... Create new messages from this application, hope it will work well. Being a proud owner of NSeries phone, you can also install either Nokia NSeries PC Suite 2.0.262 or Nokia OVI Suite 1.0.417 etc on your pc along with Nokia PC Suite.
    With the help of Nokia PC Suite (7.x), you can edit your Contacts and Messages and with the help of Nokia NSeries or OVI Suite, we may feel the new PC Suite UI ....
    You can have both the PC Suites ( NOkia pc suite & NSeries PC Suite or Nokia PC Suite & Nokia OVI Suite) got installed on the same time which wont be harmful... Hope your issue will get resolved. Best of luck

  • Photoshop CS6 cannot open or create new file.  This happened after running CCleaner

    Photoshop CS6 cannot open or create new file.  This happened after running CCleaner

    Hi, I've been asked to join this discussion. CCleaner is a nice tool, but if you used the Registry Cleaner that came with it, it might have done something to Photoshop's registry entries. There is that danger in using them.
    One thing CCleaner does is leave a backup of the registry, or you can use Windows System Restore to go to that point before you ran the Cleaner. Let's go with System Restore. Review the instructions.
    System Restore - Microsoft Windows
    If you suspect a virus, I'd like to direct you here http://bleepingcomputer.com/
    That would be the "Am I infected?" forum.
    They have the tools, you run them, and copy and paste the logs that are generated. They are very good at this, but it is super important you follow directions and don't leave until the process is completed.
    Gene

  • HT1550 I'm having trouble with importing them into iTunes and converting them at the same time. when i hold down option over the files i can't find where its supposed to say create new version. is this if you're in iTunes?

    I'm having trouble with importing them into iTunes and converting them at the same time. when i hold down option over the files i can't find where its supposed to say create new version. is this if you're in iTunes?

    You can't do it in one step. Add to iTunes first, Once the tracks are in iTunes you may convert to a different format.
    tt2

  • I have problems with creating new projects in iMovie.

    I have problems with creating new projects. When i try, the mac says the following "Make sure there is enough disk space and that you have permission to write the projects to the drive." I have 8GB available, so its not that.

    thanks for your support
    lol

  • Problem in creating new row

    Hi,
    I am facing a strange problem. i have created many new rows and inserted the data, but now i am facing a strange problem.
    This is my requirement.
    I have table with table action button as create.
    when i click create it is not at all creating new row for the view object but instead it will take the row at the top of the table and replace that line with new data.
    Below is the code :
    In CO
    In PR
    if (!pageContext.isBackNavigationFired(false))
    TransactionUnitHelper.startTransactionUnit(pageContext, "RVSchematicAttributeCreateTxn");
    if (!pageContext.isFormSubmission())
    System.out.println("control entered create block");
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    System.out.println("before calling ");
    am.invokeMethod("createRVSchematicAttribute",null);
    System.out.println("after calling ");
    else
    if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext, "RVSchematicAttributeCreateTxn", true))
    OADialogPage dialogPage = new OADialogPage(NAVIGATION_ERROR);
    pageContext.redirectToDialogPage(dialogPage);
    IN PFR
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if(pageContext.getParameter("Apply")!=null)
    System.out.println("apply button is clicked");
    OAViewObject vo = (OAViewObject)am.findViewObject("xxczVAGCSSchematicAttributeVO1");
    String schematicId = (String)vo.getCurrentRow().getAttribute("SchematicId");
    String msg= "SchematicId "+schematicId+"has been added";
    am.invokeMethod("apply");
    System.out.println("returned back to create CO");
    OAException confirmMessage = new OAException(msg,OAException.CONFIRMATION);
    pageContext.putDialogMessage(confirmMessage);
    pageContext.forwardImmediately("OA.jsp?page=/va/oracle/apps/xxcz/gcs/maintenance/webui/xxczVAGCSRVSchematicAttributeResultsPG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    null,
    true, // retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
    in AM
    public void createRVSchematicAttribute()
    System.out.println("entered createRVSchematicAttribute ");
    xxczVAGCSSchematicAttributeVOImpl vo = this.getxxczVAGCSSchematicAttributeVO1();
    // OAViewObject vo = (OAViewObject)this.getxxczVAGCSSchematicAttributeVO1();
    vo.setMaxFetchSize(0);
    vo.clearCache();
    if (!vo.isPreparedForExecution())
    vo.executeQuery();
    /* Row row = vo.createRow();
    vo.insertRow(row);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    System.out.println("Row.STATUS_INITIALIZED");*/
    int rowCount = vo.getRowCount();
    Row row = vo.createRow();
    vo.insertRowAtRangeIndex(rowCount, row);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    Please help me i don't know where i am going wrong. i have checked so many times but didn't find any bug.
    -Mithun

    Hi Zafar,
    Ok i will explain my problem with an example.
    I have employee table with following fields.
    Empname
    Empnumber
    Salary
    Table data
    Empname EmpNumber Salary
    Jack 10 1000
    sam 20 2000
    joe 30 3000
    Above is the table structure for which i need to add another row
    I have two page one results page and another create page
    In Results page i will show the above table structure with table action button "Create" in order to insert new record to table.
    When i click Create button it will navigate to create page
    In Create page i will get the below data
    Empname : Jack
    Empnumber :10
    Salary :1000
    Instead of
    Empname :
    Empnumber :
    Salary :
    suppose now if i change the jack to jack1 , 10 to 11 , or 1000 to 10001 and click submit
    Now the result page will show
    Empname EmpNumber Salary
    Jack1 11 1001
    sam 20 2000
    joe 30 3000
    No fourth row is created it is actually behaving like update functionality and updating the top most row.
    -Mithun

Maybe you are looking for

  • Worklist : display of open items selected by blart

    Hi Experts, I'm a newbie on FSCM , my need is to show in the worklist only open items related to a single document type , the request was to develop this into a collection rule but if I'm not wrong seems that from the badi ( UDM_BASIS_RULE ) is not p

  • BC4J with Swing Application

    Is there possible to use Business Components for Java in Java/Swing applications without using any kind of application server?

  • Can't find Google Mobile in App Store?

    Like the title says, I can't find Google Mobile in the app store. Am I missing something?

  • ABAP sneak preview (NSP) patch without Solution Manager after patch 11

    I'm wondering if there is any plan to allow us ABAP sneak preview users to patch our system beyond patch level 11. So far I kept my NSP system up-to-date by patching it regularly. But now the Solution Manager is required to download the current patch

  • Did not answer and changed nothing!

    Hi! This really is strange. I used to be able to connect to the appletest servers perfectly. Also video chatted with my dad last week without a problem. And I changed nothing on my side. Suddenly I get the error hat I supposedly did not answer. when