Confusion on method type declaration

I am newbie...I am trying to invoke 2 methods and get their return to output a suitable message but I get an error message that I could not understand. Can anyone help.
The error is as follows:
/tmp/16121/Daniel.java:194: incompatible types
found : int
required: boolean
if (digitsWellPlaced(solutionObjectArray,tabObjectArray))
^
/tmp/16121/Daniel.java:202: correctDigitsBadlyPlaced(char[],char[]) in Daniel cannot be applied to (java.lang.String)
System.out.println(wellPlaced +" are well palced and" + correctDigitsBadlyPlaced(badlyPlaced +" badly placed"));
^
2 errors
The code is as follows:
public void runInputCheck(char[]solutionObjectArray,char[]tabObjectArray)
int wellPlaced;
int badlyPlaced;
wellPlaced = digitsWellPlaced(solutionObjectArray,tabObjectArray);
badlyPlaced = correctDigitsBadlyPlaced(solutionObjectArray,tabObjectArray);
if (checkTheNumLength(tabObjectArray))
if (digitsWellPlaced(solutionObjectArray,tabObjectArray))
System.out.println("You won");
else
System.out.println(wellPlaced +" are well palced and" + correctDigitsBadlyPlaced(badlyPlaced +" badly placed"));
public int digitsWellPlaced(char[] firstArray,char[] secondArray)
for (int i=0;i<5;i++)
if (firstArray==secondArray[i])
goodResult = goodResult+1;
return goodResult;
public int correctDigitsBadlyPlaced (char[] firstArray,char[] secondArray)
char[] refArray=new char[5];
int badResult = 0;
int wellPlaced = digitsWellPlaced(firstArray,secondArray);
for (int i=0;i<5;i++)
for (int j=0;j<5;j++)
if ((i!=j) || (secondArray[i]==refArray[j]))
badResult = badResult + 1;
badResult = badResult-wellPlaced;
return badResult;
Thanx

You can not make an if statement with a integer as a value, you must either set
return value to type of boolean, or declare the if statement like this
if (value == 1)
// code here
}and this line is not correct
System.out.println(wellPlaced +" are well palced and" + correctDigitsBadlyPlaced(badlyPlaced +" badly placed"));You are calling the correctDigitsBadlyPlaced(char[], char[]) method with
wrong parameters.
kari-matti

Similar Messages

  • Wildcards in type declarations or only methods?

    Can you declare wildcards in type declarations such as:
    public class ListManager<List<?>> {
    }When I try this, I get the following compiler errror:
    C:\dev\hcj\tiger\src>c:\j2sdk1.5.0\bin\javac -source 1.5 oreilly/hcj/tiger/*.java
    oreilly/hcj/tiger/ListManager.java:21: > expected
    public class ListManager<List<?>> {
                                 ^
    oreilly/hcj/tiger/ListManager.java:31: '{' expected
    ^
    2 errorsWhat am I doing wrong [if anything]?
    TIA
    -- Kraythe

    public class ListManager<List<?>> {
    }When I try this, I get the following compiler errror:Hmm .. I was thinking about this. .. What i was trying to declare was a class that would use as a parameter any declaration of a List. So what I want is a class that will take List<Integer> and List<String> and so on. So the result would be to use it like this:
    public void someMehtod() {
        ListManager<List<String>> strListMger = ...
        ListManager<List<Integer>> strListMger = ...
    }So if not with the wildcard, how is this accoplished (if it can be accomplished at all).
    I would also like to do something like:
    public class ListManager<Type extends List<?>> {
    }In this manner I would at least have access to the type. Except the extends is a misnomer since i want type to be any List<> type.

  • SAXParser type declaration not found - PLEASE HELP!!

    I am using XML to parse an incoming string of XML. I want to use an SAXParser to do this, but I cannot create an object of this type. I have the jar file jaxp.jar, xalan.jar, and crimson.jar in my classpath.
    Is there anything else that I need to do in order to get the parser to work.
    This is a very urgent need so any help is appreciated. Here is the error:
    Class SAXParser not found in type declaration;

    I have figured out the issue. Thanks for the help. I do have one more issue though. I am trying to parse a string of xml data and I need to pass my parse() method an InputSource object that I guess I will make from my incoming String.
    Any thoughts on how to do this?

  • Adding XML Declaration and Document Type Declaration.

    I'm using Oracle's XML Class Generator C++ version 1.0.2.0.0. I can create classes from a defined external DTD and create my XML document. But the document does not contain the XML Declaration <?xml version='1.0?> nor does it contain the Document Type Declaration <!DOCTYPE root-element-name SYSTEM "system-identifier">. What do I need to do to get these as part of my XML document? Does the class generator have methods to do this? Could someone show me an example?

    If you invoke the print method on the top-level ELEMENT, you get
    just the body of the document with no DTD or XMLDecl. if you invoke
    print on the top level NODE (the DOCUMENT node), then the output
    document will contain the XMLDecl and DTD.
    So please try to print from DOCUMENT node.

  • Source XML data type declaration querry

    Hi all,
    I am very confused in below XML data type declaration.
    I am dealing first time with this type of XML.
    In source XML header items are mentioned in header node(address).
    <address addressline1="6th & Hunt" addressline2="" city="Pryor" state="OK" country="Sun" zip="74361">
    - <phoneinfo>
      <phone type="work">9999999999</phone>
      </phoneinfo>
    - <faxinfo>
      <fax>100000001</fax>
      </faxinfo>
    </address>
    Please Help in the "Data type declaration" of above source XML????
    How can i use this data type in message mapping????
    Thanks & Regards

    Hi Umesh,
    You can use Data types with Attributes in XI.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/3b/d2a3f7a166514abb8cf5635b71974f/frameset.htm
    And you can even try with the External Definition also.
    Hope this helps,
    regards,
    Moorthy

  • Global Type declaration/definition of name duplicated error

    Hi, All,
    We have two EJB exposed as the Webservice , so WS-1 and WS2, When I insert these two WS into the SOA Application to used by BPEL process. I get the compile error from jdev(11.1.1.1.3) like this:
    Global Type declaration/definition of name '{http://mynamespace-here/oracle}SearchParameter' are duplicated at the following locations:
    EJB WS1 xsd line ***
    EJB WS2 xsd line ***
    SearchParameter is bean SearchRequest‘s property, this bean is shared using in two EJB method interfaces.
    Our class design like this:
    @XmlRootElement
    @XmlType(name = "SearchRequest",
    namespace = " http://mynamespace-here/oracle ")
    public class SearchRequest
    implements Serializable
    private SearchInterface searchCriteria;
    @XmlElements(value =
    { @XmlElement(name = "SearchParameter",
    type = SearchParameter.class) })
    public SearchInterface getSearchCriteria()
    return searchCriteria;
    At here SearchInterface is an empty interface and SearchParameter is a class implement this interface.
    I feel @XmlElement in fact cause this duplicated error.
    So in this case, how can we expose this SearchInterface/SearchParameter through the XML properly?
    Thanks .
    wayne
    Edited by: user782942 on Feb 8, 2011 11:37 PM

    If the message type in the external service and the one using in your local are using the same schema, could you check whether the external service has changed the schema in any way? Adding new fields, changing the field name, or changing the namespace? We had faced this issue before, and it was because the schema in our mds is different from the schema from OSB, which they changed it after we get the artifacts and we didn't have the updated schema in our mds.

  • Annotation Type Declaration

    Why in anno type declaration some types look like methods ?
    Example:
    public @interface MyAnnotation {
       String doSomething();                   //HERE
       int count; String date();                 // int is fine but , String , why its a method ?
    Usage:
    @MyAnnotation (doSomething="What to do", count=1,
                   date="09-09-2005")
    public void mymethod() {
    }

    ya ..
    it says
    "The annotation type definition looks somewhat like an interface definition where the keyword interface is preceded by the @ character (@ = "AT" as in Annotation Type). Annotation types are, in fact, a form of interface, which will be covered in a later lesson. For the moment, you do not need to understand interfaces.
    +The body of the annotation definition above contains annotation type element declarations, which look a lot like methods. Note that they may define optional default values.+ "
    But does not explain why they are metods , observe in the above example that ,
    primitive int is directly declared , not as a method ,
    Then all should be methods ..

  • Capturing packages with type declarations

    I have a lot of packages written in ddl files and want capture them with Designer 9i. However it seems not possible because type declarations are put not as Datastructures but as text in Package Specification field and therefore are generated after procedure declarations in package specification. Is there some methods to capture packages correctly?

    Hi,
    Can you send me an example of your problem so I can investigate it further?
    Rgds
    Susan
    Designer Product Management

  • Flex warning: variable has no type declaration

    I need to  dynamically create several Form or Panel, called MyForm1, MyForm2, MyPanel1, MyPanel2, ... They are different because of the children in the Form or Panel. I also added some addtional public methods (method1, method2 ...) to the <mx:Form> or <mx:Panel>.
    I have a function, called myFactory,  that returns the MyForm1, MyPanel1... for me according to the input parameters. It is defined something like:
    function myFactory(input:String):DisplayObject {
    I tried two ways to call myFactory.
    1.
    var myViewObj:DisplayObject = myFactory(input:String); // no error. no warning.
    myViewObj.method1(); // compilation error because DisplayObject dose not have method1
    2.
    var myViewObj = myFactory(input:String); // no error, but got warning: variable has no type declaration
    myViewObj.method1(); // it works fine.
    It looks like the type of myViewObj is the actual type of myFactory retures, which could be one of MyForm1, MyPanel1....
    My questions are
    1. Is there a way I can declara a type to myViewObj to get ride of  warning.
    2. what type myViewObj should be called? generic type?

    In case your custom Form and Panel components share same method names (with different functionality), you can create an Interface with the common methods declaration and have both components implement it.
    This way you can declare the new interface as the returned type and invoke the common methods that it have.
    Thia is sort of a Polymorphism technic, a subject where you can read more about in the following page -
    http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming
    Good luck!

  • How to use %Type declaration with table residing in a different database

    How can I use the %TYPE declaration if the table is from a different database.
    E.g
    v_business_unit ps_jrnl.header.business_unit%TYPE;
    In the above declaration statement,the table 'ps_jrnl_header' resides in a different database(Database A) from the one I am currently in( Database B).(This is because data needs to be extracted from Database A into Database B).

    1. Create a database link to the other database (this probably already exists since your proc is interacting with that database)
    2. Create a synonym for the table in the other database
    create synonym foo for ps_jrnl.header@database_a;3. Reference the synonym in your variable declaration:
    v_business_unit  foo.business_unit%TYPE;

  • How to use the method "getChildrenRemoved()" declared in ElementChange?

    How to use the method "getChildrenRemoved()" declared in DocumentEvent.ElementChange?

    I have tried to use it,but the code below alway say "Yes"....
    I really have no ideas about why ec is always a null.
    public void removeUpdate(DocumentEvent ee) {
           DocumentEvent.ElementChange ec = ee.getChange(doc.getDefaultRootElement());
           if(ec == null)
              System.out.println("Yes");
                     }

  • "Global Type declaration duplicated", cached xsd conflicting in jdeveloper?

    We're having problems recompiling a project after changing a schema in a second project on which it depends:
    Our HR composite app imports a schema from our FaultHandler app. I added 2 new elements to the FaultHandler schema and redeployed to the server - now our HR composite app won't recompile. It errors saying:
    [scac] error: in EmpTransformSynch.bpel(87): query "/ns9:HandleFaultRequest/ns9:TimestampeInit" is invalid, because Global Type declaration/definition of name '{http://mydomain.com/SOA/FaultHandler}HandleFaultRequestType' are duplicated at the following locations:
    [scac] http://mydomain.com:8001/soa-infra/services/default/FaultHandlerProject/xsd/FaultHandler.xsd [line#: 4]
    [scac] http://mydomaincom:8001/soa-infra/services/default/FaultHandlerProject/FaultHandler?XSD=xsd/FaultHandler.xsd [line#: 7]
    [scac] There are at least two of them looking different:
    [scac] http://mydomain.com:8001/soa-infra/services/default/FaultHandlerProject/xsd/FaultHandler.xsd [difference starting at line#:16]
    [scac] http://mydomain.com:8001/soa-infra/services/default/FaultHandlerProject/FaultHandler?XSD=xsd/FaultHandler.xsd [difference starting at line#:19]
    I can view the 2 URIs in my browser, and while they differ slightly in how they reference another schema, the schemas (and imported schema) are semantically equivalent.
    We've taken the following steps to try to resolve it:
    Undeploy the previous revision of Fault handler
    Restart soa server
    Redepoy Fault Handler
    Clean HR app
    Make HR app
    We have the issue in both jdeveloper 11.1.1.3.0 and 11.1.1.4.0
    This is surely something very simple, but it's blockiing us at the moment.
    Any help much appreciated.
    ..Garret
    Edited by: user10714498 on 09-Mar-2011 02:27

    If your schema contains any characters which will be escaped when parsed by a browser, then version present in the actual .xsd and the version referenced via HTTP server will be different causing the issue.
    If you can post the content of your actual schema (as you see it in jDev and not the one opened in the browser) here it will help identifying the issue if any.

  • ACE http probe "request method type" mandatory on A3(2.6)?

    Hi people,
    I recently upgraded to A3(2.6) from A3(2.0) and I don't see the N/A option on the http probe "request method type".
    It also has an asterisk * which means it's mandatory.
    I tried to set up a new http probe for another farm I am creating and the probe shows status failed, although I can ping and telnet to the http server on port 80 from the ACE context. My probe is like that:
    probe http http_probe_WWW
      interval 15
      passdetect interval 60
      expect status 200 200
      open 10
    My other http probes for other farms work ok after the upgrade and they are similar.
    So my question is: Do I need to set the request method type or something else causes the probe to fail?
    thanks a lot.
    George

    What you see is a problem with the GUI.
    CSCtg78008    while creating http probe default method slected should be get as in CLI
    But the request-method is not required.
    So your config should work.
    Do a 'show probe detail' to see the failure reason.
    Get a sniffer trace as well.
    Regards,
    Gilles.

  • How can i use Catalog in Method Type?

    Dear Experts,
    How can i use Catalog in Method Type?
    I want to use Multiple method type mean require selection option(help from catalog)and also need to entere the result against certain parameters. So how can i do this possible ?
    Except use of additional infrmation field
    Regards,
    Abhishek

    Hi,
    Can i provide selection option F4 help at Method while enteing the result?
    Because for 1 MIC as per buyer method testing different so it will come alternately.
    i.e i have 3 methods which comes altarnative for one MIC
    TST_ISO
    TST_AATC
    TST_ASTM
    So how it is possible???

  • [svn] 3571: Update SWFLoader ASDoc comment to remove &emdash and data type declaration .

    Revision: 3571
    Author: [email protected]
    Date: 2008-10-10 11:07:09 -0700 (Fri, 10 Oct 2008)
    Log Message:
    Update SWFLoader ASDoc comment to remove &emdash and data type declaration. ASDoc adds that automatically.
    Doc the new types in IndexChangedEvent.as
    Checkin Test Passed: Yes
    QA: No
    Bug:
    Doc: No
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/SWFLoader.as
    flex/sdk/trunk/frameworks/projects/framework/src/mx/events/IndexChangedEvent.as

    lunke you shoude change svn update http://svn.foo-projects.org/svn/xfce/modules/trunk to svn up $startdir/src/trunk
    hers a PKGBULID for thunar
    pkgname=thunar
    pkgver=0.0.2.r17470
    pkgdesc="Thunar is a file manager designed for Xfce. It is currently under development."
    url="http://thunar.xfce.org/wiki/"
    depends=('exo-svn')
    makedepends=('subversion')
    source=()
    md5sums=()
    build() {
    if [ ! -d $startdir/src/thunar ]; then
    echo "Fetching sources..."
    svn checkout http://svn.foo-projects.org/svn/xfce/thunar/trunk/ /thunar
    else
    echo "Updating sources..."
    svn up $startdir/src/thunar/
    fi
    cd $startdir/src/thunar
    ./autogen.sh --prefix=/opt/xfce4-svn
    make || return 1
    make DESTDIR=$startdir/pkg install
    find $startdir/pkg -name '*.la' -exec rm {} ;
    you will need exo from svn as well
    pkgname=exo-svn
    pkgver=r17470
    pkgdesc="Extensions to Xfce by os-cillation"
    url="http://libexo.os-cillation.com/"
    conflicts=(exo)
    provides=(exo)
    depends=('xfce4-svn')
    makedepends=('subversion')
    source=()
    md5sums=()
    build() {
    if [ ! -d $startdir/src/trunk ]; then
    echo "Fetching sources..."
    svn checkout http://svn.foo-projects.org/svn/xfce/libexo/trunk/
    else
    echo "Updating sources..."
    svn up $startdir/src/trunk
    fi
    cd $startdir/src/trunk
    ./autogen.sh --prefix=/opt/xfce4-svn
    make || return 1
    make DESTDIR=$startdir/pkg install
    find $startdir/pkg -name '*.la' -exec rm {} ;
    "Operation libtool-slay" compliant

Maybe you are looking for

  • Which Table, can I find the class and characteristic assigned to equipment.

    Hi all, I have assigned a characteristc to a class. And assigned this class to an equipment. Now in which table can i find the class assigned to this equipment. What is the logic to find the class and characteristic. Thanks in advance. Piyush

  • Solaris 10 - top command show only half memory

    I have 64Gb of RAM but top Solaris only use 32Gb Output from "prtdiag" command: ==== Memory Device Sockets ================================ Type    Status Set Device Locator      Bank Locator Unknown in use 1   DIMM 1A             Unknown in use 3  

  • Webdynpro model context mapping issue

    Hi, I have created a faceless Web Dynpro model component (DC1) and an UI Component (DC2). DC1 is an used component in DC2. After mapping the model node from the interface controller of DC1 to DC2 it says "Referenced model class is missing". I asume,

  • TECO for order created without material

    Hi I want to schedule background program for putting teco status to all order created without materialand which are having CNF status. Orders which has recived CNF status on date which is  60 days in past  from current date Please guide how to do tha

  • Has anyone else lost all information listed on "Notes" after downloading Mavericks!!?

    Much trouble since downloading Mavericks. Some programs not running at all. All my Notes have disappeared. Any help with retrieving them, anyone?