CompareTo(Comparable) cannot be applied to...

When I try to compile my set of files, while trying to create a priority queue, I get the following errors:
Lijst.java:53: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
    if (lst == null || x.compareTo (lst.wrd) <= 0 ) {
                        ^
Lijst.java:58: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
    while (h.succ != null && x.compareTo (h.succ.wrd) > 0) {
                              ^
Lijst.java:69: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
    if (lst == null || x.compareTo (lst.wrd) < 0 ) {
                        ^
Lijst.java:74: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
    while (h.succ != null && x.compareTo (h.succ.wrd) > 0) {
                              ^
Lijst.java:78: compareTo(Comparable) in Comparable cannot be applied to (java.lang.Object)
    if (h.succ == null || x.compareTo (h.succ.wrd) < 0) {But x was typecasted to a Comparable in Lijst.java:
  void voegIn (Object y) {
    Comparable x = (Comparable) y;
    if (lst == null || x.compareTo (lst.wrd) <= 0 ) {
      zetVoor (x);
      return;
  }Why does Java forget that typecast???

But that's why I've tried to typecast it to a
Comparable. Because the argument of the compareTo
function will be of type Toestand which implements
Comparable.
What's the alternative for this, if this is all
wrong??Looks like you'll need to cast both the reference to
the object whose method you're invoking and the
reference to the argument. Comparable foo = (Comparable)bar;
bar.compareTo((Comparable)lst.wrd); Or something like that.And of course this only works if lst.wrd points to an object that actually does implement Comparable.

Similar Messages

  • Method cannot be applied error

    I am having trouble compiling my application because it says a sorting method I want to use cannot be applied to the array I want to sort.
    I have a class that was supplied by my instructor that contains a constuctor for an object called "automobile". This constructor has 4 args which are (string, string, double, double). The strings are for make and model of vehicle and the doubles are for gas tank size and range on a full tank. The constructor takes the double values and calculates the miles per gallon. In my application I am making an array of 15 vehicles called "automobile". When I print to an outpuBox the list of vehicles, everthing looks fine. The problem is I need to sort the array by the miles per gallon. Now I have made a seperate class the contains my "cocktail shaker sort", but when it seems that the array of vehicles I created cannot be used in the args of the sort method. Any help would be greatly appeciated. This thing was due a week ago and I've been pulling my hair for 3weeks.
    The error message is:
    Autos.java:64: cockTailSort(int[]) in CockTail cannot be applied to (Automobile[])
    CockTail.cockTailSort(automobile);
    1 error
    Below is my application and following that will be the cocktailshaker class.
    import javabook.*;
    import java.text.DecimalFormat;
    class Autos
    public static void main (String[] args){
    MainWindow mainWindow;
    InputBox inputBox;
    OutputBox outputBox;
    MessageBox messageBox;
    ResponseBox responseBox;
    String modelName, modelType;
    double gasTankCapacity, rangeOnFullTank;
    int count;
    mainWindow = new MainWindow ("Automobile input");
    inputBox = new InputBox (mainWindow);
    outputBox = new OutputBox (mainWindow);
    responseBox = new ResponseBox (mainWindow );
    messageBox = new MessageBox (mainWindow);
    messageBox.setVisible (false );
    mainWindow.setVisible ( true ) ;
    outputBox.setVisible ( true ) ;
    Automobile[] automobile = new Automobile [3];
    int i=0;
    count =1;
    for (i = 0 ; i < automobile.length ; i ++){
    modelName = inputBox.getString ("Enter Model Name for vehicle #" + count);
    modelType = inputBox.getString ("Model Type for #" + count);
    gasTankCapacity = inputBox.getDouble("Gas capacity for #" + count);
    rangeOnFullTank = inputBox.getDouble("Fulltank range for #" + count);
    automobile[ i ] = new Automobile ( modelName, modelType,gasTankCapacity,rangeOnFullTank );
    count ++;
    CockTail.cockTailSort(automobile);
    for (i = 0 ; i < automobile.length ; i ++){
    automobile.displayAutomobile(outputBox);
    Here is the sort:
    import javabook.*;
    class CockTail
    public CockTail()
    public static void cockTailSort (int a [] )
    boolean sorted = false;
    int top = a.length -1, bottom =0;
    for (int pass =1; bottom < top && !sorted; pass ++)
    sorted = true;
    if (pass % 2 != 0) // odd # passes
    for (int i = bottom; i < top; i ++)
    if (a[i] > a[i + 1])
    sorted = false;
    int temp = a[i];
    a[i] = a[i + 1];
    a[i + 1] = temp;
    top --;
    else // even-numbered passes
    for (int i = top; i > bottom; i--)
    if (a[i - 1] > a[i])
    sorted =false;
    int temp = a[i];
    a[i] = a[i - 1];
    a[i - 1] = temp;
    bottom ++;

    Well I changed it to what you said and it didn't work. I really appreciate your though.
    Here are the source codes :
    import javabook.*;
    import java.util.*;
    import java.text.DecimalFormat;
    class Autos
    * Setting data members and constructors
    public static void main (String[] args){
    MainWindow mainWindow;
    InputBox inputBox;
    OutputBox outputBox;
    MessageBox messageBox;
    ResponseBox responseBox;
    String modelName, modelType;
    double gasTankCapacity, rangeOnFullTank;
    int count;
    mainWindow = new MainWindow ("Automobile input");
    inputBox = new InputBox (mainWindow);
    outputBox = new OutputBox (mainWindow);
    responseBox = new ResponseBox (mainWindow );
    messageBox = new MessageBox (mainWindow);
    messageBox.setVisible (false );
    mainWindow.setVisible ( true ) ;
    outputBox.setVisible ( true ) ;
    outputBox.printLine("This program will ask for data for 15 vehicles and ");
    outputBox.printLine("calculate the Miles Per Galllon for each vehicle and ");
    outputBox.printLine("compare the MPGs to be displayed in a sorted list in an outpuBox.");
    outputBox.printLine("you will be asked to enter the vehicles model, model type");
    outputBox.printLine("gas tank capacity and total range on a full tank.");
    // create an automobile array
    Automobile[] automobile = new Automobile [3];
    * Loop for data inputs an array creation
    int i=0;
    count =1;
    for (i = 0 ; i < automobile.length ; i ++){
    modelName = inputBox.getString ("Enter Model Name for vehicle #" + count);
    modelType = inputBox.getString ("Model Type for #" + count);
    gasTankCapacity = inputBox.getDouble("Gas capacity for #" + count);
    rangeOnFullTank = inputBox.getDouble("Fulltank range for #" + count);
    automobile[ i ] = new Automobile ( modelName, modelType,gasTankCapacity,rangeOnFullTank );
    count ++;
    *Code for cocktail sort method call
    CockTail.cockTailSort(automobile); // Error in code
    * Display data and MPG's in outputBox
    for (i = 0 ; i < automobile.length ; i ++){
    automobile.displayAutomobile(outputBox);
    Here is the cocktail shaker sort:
    import javabook.*;
    import java.util.*;
    class CockTail
    //public CockTail()
    public static void cockTailSort (Automobile[] a )
    boolean sorted = false;
    int top = a.length -1, bottom =0;
    for (int pass =1; bottom < top && !sorted; pass ++)
    sorted = true;
    if (pass % 2 != 0) // odd # passes
    for (int i = bottom; i < top; i ++)
    if (a[i] .compareto( a[i + 1])==1)
    sorted = false;
    Automobile temp = a[i];
    a[i] = a[i + 1];
    a[i + 1] = temp;
    top --;
    else // even-numbered passes
    for (int i = top; i > bottom; i--)
    if (a[i] .compareto( a[i - 1])==1)
    sorted =false;
    Automobile temp = a[i];
    a[i] = a[i - 1];
    a[i - 1] = temp;
    bottom ++;
    Here is what I know of the Automobile class:
    // JBuilder API Decompiler stub source generated from class file
    // Aug 6, 2002
    // -- implementation of methods is not available
    // Imports
    import java.lang.String;
    import javabook.OutputBox;
    class Automobile {
    // Fields
    private String modelName;
    private String modelType;
    private double gasTankCapacity;
    private double rangeOnFullTank;
    private double milesPerGallon;
    // Constructors
    public Automobile() { }
    public Automobile(String p0, String p1, double p2, double p3) { }
    // Methods
    public int compareto(Automobile p0) { }
    public void displayAutomobile(OutputBox p0) { }

  • Create(java.io.InputStream) in Scanner cannot be applied to (java.io.File)

    Ahhh!!!
    Ahem, when I try to compile the file below, "PhoneDirectory.java", I get the following compilation error message:
    PhoneDirectory.java:12: create(java.io.InputStream) in Scanner cannot be applied to (java.io.File)
        Scanner fin = Scanner.create(file);After quite a bit of tweaking... I'm right back where I started. I'm a seasoned programmer, as far as concepts are concerned, but rather new to JAVA.
    The error seems to be occuring where a new instance of "Scanner" is supposed to be created. It uses file I/O, and I had only used the Scanner class for the keyboard input in the past.
    Looking at the Scanner class, everything seems to be right to me. I'm probably missing some simple fundamental concept, and I've been pulling my hair out trying to get it... Please help me shed some light on this situation!
    =========
    PhoneDirectory.java
    =========
    import java.io.*;
    // Read a file of names and phone numbers
    // into an array. Sort them into ascending
    // order using bubble sort.
    // Print names and numbers before and after sort.
    public class PhoneDirectory {
      public static void main (String[] args) {
        PhoneEntry[] directory = new PhoneEntry[200];
        File file = new File("c:\\jessica\\phonenum.txt");
        Scanner fin = Scanner.create(file);
        int numberEntries = 0;
        // read array from file
        while (fin.hasNextInt())
          directory[numberEntries++] = new PhoneEntry(fin);
        // print array as read
        for (int i=0; i<numberEntries; i++)
          System.out.println(directory);
    // sort by ordering defined in PhoneEntry,
    // in this case lastName firstName
    bubbleSort(directory, numberEntries);
    // print sorted array
    System.out.println(
    "============================================");
    for (int i=0; i<numberEntries; i++)
    System.out.println(directory[i]);
    static void bubbleSort(PhoneEntry[] a, int size) {
    // bubbleSortr: simple to write, but very inefficient.
    PhoneEntry x;
    for (int i=1; i<size; i++)
    for (int j=0; j<size-i; j++)
    if (a[j].compareToIgnoreCase(a[j+1]) > 0) {
    // swap
    x = a[j]; a[j] = a[j+1]; a[j+1] = x;
    =========
    PhoneEntry.java
    =========
    class PhoneEntry {
    // number, name entry for a line in a Phone Directory
      protected int area;
      protected int prefix;
      protected int number;
      protected String firstName;
      protected String lastName;
      public String toString() {
      // format name and phone number to printable string
        String x = lastName + ", " + firstName;
        x = x +
        " . . . . . . . . . . . . . . .".substring(x.length())
        + "(" + area + ") " + prefix + "-" + number;
        return x;
      public int compareToIgnoreCase(PhoneEntry v) {
      // alphabetically compare names in this to names in v
      // return negative for this < v, 0 for ==,
      //        positive for this > v
        int m = lastName.compareToIgnoreCase(v.lastName);
        if (m == 0) m = firstName.compareToIgnoreCase(v.firstName);
        return m;
      public PhoneEntry(Scanner fin) {
      // input a PhoneDirectory entry. Must be space delimited
      // area prefix suffix lastname firstname
        // number
        area = fin.nextInt();
        prefix = fin.nextInt();
        number = fin.nextInt();
        // read rest of line
        String name = fin.nextLine();
        // split name into lastName firstName
        int p = name.indexOf(' ');
        if (p > 0) {
            lastName = name.substring(0,p);
            firstName = name.substring(p+1);
        else {
            lastName = name;
            firstName = "";
    }=========
    Scanner.java
    =========
        This class does input from the keyboard.  To use it you
        create a Scanner using
        Scanner stdin = Scanner.create(System.in);
         then you can read doubles, ints, or strings as follows:
        double d; int i; string s;
        d = stdin.nextDouble();
        i = stdin.nextInt();
        s = stdin.nextLine();
        An unexpected input character will cause an exception.
        You cannot type a letter when it's expecting a double,
        nor can you type a decimal point when it's expecting an int.
    import java.io.*;
    public class Scanner {
    // Simplifies input by returning
    // the next value read from the
    // keyboard with each call.
      private String s;
      private int start=0, end = 0, next;
      private BufferedReader stdin;
      Scanner(InputStream stream) {
        start = end = 0;
        // set up for keyboard input
        stdin = new BufferedReader(
        new InputStreamReader(stream));
      public static Scanner create(InputStream stream) {
        return new Scanner(stream);
      double nextDouble() {
         if (start >= end)
           try {
            s = stdin.readLine().trim() + " ";
              start = 0;
             end = s.length();
          catch (IOException e) {System.exit(1);}
         next = s.indexOf(' ',start);
         double d = Double.parseDouble(s.substring(start,next));
         start = next+1;
         return d;
      public int nextInt() {
         if (start >= end)
           try {
            s = stdin.readLine().trim() + " ";
              start = 0;
             end = s.length();
          catch (IOException e) {System.exit(1);}
         next = s.indexOf(' ',start);
         int d = Integer.parseInt(s.substring(start,next));
         start = next+1;
         return d;
      public String nextLine() {
         if (start >= end)
           try {
            s = stdin.readLine().trim() + " ";
              start = 0;
             end = s.length();
          catch (IOException e) {System.exit(1);}
         String t = s.substring(start,s.length()-1);
         start = end = 0;
         return t;
    }=========
    phonenum.txt
    =========
    336 746 6915 Rorie Tim
    336 746 6985 Johnson Gary
    336 781 2668 Hoyt James
    606 393 5355 Krass Mike
    606 393 5525 Rust James
    606 746 3635 Smithson Norman
    606 746 3985 Kennedy Amy
    606 746 4235 Behrends Leonard
    606 746 4395 Rueter Clarence
    606 746 4525 Rorie Lonnie

    I don't see a Scanner.create() method in the Scanner class but I do see a constructor with the signature you want. Change
    Scanner fin = Scanner.create(file);
    to
    Scanner fin = new Scanner(file);

  • Cannot be applied to (java.io.PrintWriter) error

    Hi guys I get the following errors when trying to compile my program and I was wondering how to solve it
    printPay() in PaySlip cannot be applied to (java.io.PrintWriter)
    slip.printPay(slipWrite)
    import java.io.*;
    public class PayApp
      public static void main(String[] args)
        boolean end_of_file = false;
        EmpInFile   f1 =  new EmpInFile(); 
        EmpOutFile  f2 =  new EmpOutFile();
        Employee    emp = null;       
        PaySlip     slip = null;           
        Report   sum = null;     
        PrintWriter slipWrite = null;
        PrintWriter sumWrite  = null;
        if (args.length != 4)    // correct number ?
          errExit("Names of Input employee file , output employee file, payslip file \n, and report file required");
         emp = new Employee();
         sum =   new Report();
         slip  = new PaySlip(emp,sum);
       try
           f1.openFile(args[0]);  
           f2.openFile(args[1]);  
           slipWrite = new PrintWriter(new FileWriter(args[2]));
           sumWrite =  new PrintWriter(new FileWriter(args[3]));
          catch(IOException e)
             System.err.println("error opening files" + e.toString());
             System.exit(1);
         while (!end_of_file )
            end_of_file = f1.readRecord(emp);
            if(!end_of_file)
               slip.printPay(slipWrite); 
               f2.addRecord(emp);  
            }// end if ! end
          }// end while
           System.out.println("All employees processed ");
           sum.printTotals(sumWrite);  
           sumWrite.flush();
           sumWrite.close();        
           slipWrite.flush();
           slipWrite.close();
           f1.closeFile();
           f2.closeFile();
      static void  errExit(String message)
       System.err.println(message);
       System.exit(1);
    public class PaySlip
    // declare variables
         private double gross;
         private double tax;
         private double taxcredits;
         private Employee emp;
         private Report rep;
         public PaySlip (Employee e, Report r)
         emp = e;
         rep = r;
         double gross = 0;
         double tax = 0;
         double taxcredits = 0;
         public void setGross(double gr)
         gross = gr;
         public void setTax(double tx)
         tax = tx;
         public void settaxCreds(double taxcreds)
         taxcredits = taxcreds;
         public void printPay()
         emp.calcPay(this);
         double netpay;
         netpay = gross - tax;
         System.out.println("____________________________________________________");
         System.out.println("               Payslip Information                  ");
         System.out.println("Employee Name: \t\t" +emp.getFirst() +" "+ emp.getLast());
         System.out.println("Employee Id: \t\t" +emp.getId());
         System.out.println("Net Pay: \t" +netpay);
         System.out.println("Year To Date Gross: \t" +emp.getYtdGross());
         System.out.println("Year To Date Tax: \t" +emp.getYtdTax());
         System.out.println("____________________________________________________");
         System.out.println("               Department Totals                    ");
         char dcode = emp.getDeptCode();
         rep.addToTotals(gross,tax,dcode);
    }Any help would be greatly appreciated.

    Post the actual error which would in include a line number when noting errors.
    slip.printPay(slipWrite); The method printPay() does not take parameters. So you can't put 'slipWrite" there.

  • PSE 9.0.3 update can't install. Error message is "patch cannot be applied."

    PSE 9.0.3 does not install. Error message "patch cannot be applied."

    Manually install the download the update from below given link:-
    For Mac:- http://www.adobe.com/support/downloads/detail.jsp?ftpID=5012
    For Win:- http://www.adobe.com/support/downloads/detail.jsp?ftpID=5000
    Download and install the update.

  • Cannot install update 9.0.3 in my Photoshop Elements 9. Getting error msg "Patch cannot be applied".

    Cannot install update 9.0.3 in my Photoshop Elements 9. Getting error msg "Patch cannot be applied". How can I correct?

    Nobody can know. You are not offering system info or otehr details. Start by uninstalling and reinstalling the base program.
    Mylenium

  • Operator + cannot be applied to operands of type 'method group and 'int'

    Hello I have a problem that I'm trying to fire a bullet everytime I pressed the spacebar key, but I have this problem that is cropping up.
     if ((e.KeyCode == Keys.Space) && (playerOne.Bullet.Alive == false))
                                playerOne.Bullet.Alive = true;
                                playerOne.Bullet.getX = playerOne.getXposition + 15;
                                playerOne.Bullet.getY = playerOne.getYposition + 10;
    It says in the error list: "Opeartor '+' cannot be applied to operands of type 'method group' and 'int'", I have no clue. I'm also new to programming.

    I want to get the bullet to shoot where the player is, here is the code:
    class Player
            // attributes here  -   Int other words data types and variables:
            int health = 3;
            float xPosition;
            float yPosition;
            Bitmap playerGraphics;
            int score = 0;
            bool leftPressed;
            bool rightPressed;
            float Width = 50;
            public Bullet Bullet = new Bullet();
            // functions here:
            public void Init()
                // Get Player_Bat.png from resources, so that we can work with it:
                playerGraphics = new Bitmap(Green_Aliens.Properties.Resources.Player_Bat);
                health = 3;
                score = 0;
                xPosition = 375;
                yPosition = 540;
                leftPressed = false;
                rightPressed = false;
                Bullet Bullet = new Bullet();
            public float getWidth()
                return Width;
            public void toggleLeftPressed()
                if (leftPressed == true)
                    leftPressed = false;
                else
                    leftPressed = true;
            public void toggleRightPressed()
                if (rightPressed == true)
                    rightPressed = false;
                else
                    rightPressed = true;
            public bool getLeftPressed()
                return leftPressed;
            public bool getRightpressed()
                return rightPressed;
            public Bitmap getGraphics()
                return playerGraphics;
            public float getXposition()
                return xPosition;
            public float getYposition()
                return yPosition;
            public int getHealth()
                return health;
            public int getScore()
                return score;
            public void moveLeft()
                xPosition -= 10;
            public void moveRight()
                xPosition += 10;
            public void loseLife()
                health--;
            public void adScore(int valueAdd)
                score += valueAdd;
            //Resets the player to the start position:
            public void resetPosition()
                xPosition = 400;
                yPosition = 550;

  • Cannot be applied

    Hello,
    I am trying to call the method print();
    Could someone please tell me what parameters i need to put in to get it to call? Right now its giving me a cannot be applied error.
    The print() method is in the Coin class which is a different class. Thanks
    Coin p = new Coin()//<----pretty sure i need this to call a method in a different class
    Coin.print(not sure what to put here);
    public static void print(int ncount,int dcount,int qcount,LinkedList<String>nickels,LinkedList<String>dimes,
                                 LinkedList<String>quarters,String type)//<---method that needs to be called

    Honestly, because static methods are easier to call.Huh? Apperently you have no idea what static means.
    Sorry Im really new.No need for sorry, just do some research if you don't know what something means/does. You should use the static keyword for methods that "do not directly belong" to a specific instance of a class.
    Example:
    class Coin {
      static Coin createNickle() {
        // return a Coin with a value of a nickle
    }now you can create a Coin object with the static above:Coin nickle = Coin.createNickle();But a print() method suggests that you print the internal state of an instance (nickle is an instance of a Coin)
    class Coin {
      int value;
      static void print() {
        // from here you cannot print 'value', since the print() method is static!
        // In other words: it does not belong to this instance
    }so you should do it like this:class Coin {
      int value;
      void print() {
        // now print the 'value' variable
    }and you can now do:Coin nickle = Coin.createNickle();
    nickle.print();understand?
    Of course, you can create new intance of a Coin by calling it's constructor (if there is one), it was only an example of me to do it with a static (factory) method.

  • SAP Front-End Patch cannot be applied error

    I have SAP GUI 7.2 patch level 4 installed on my machine and I am  adobe life cycle designer. I got this error when I tried to install
    "This SAP Front-End Patch cannot be applied. Either the installed components are already on the same patch level or the components to be patched are not yet installed at all.
    SAP Interactive Forms - Adobe LifeCycle Designer 8.0 Patch
    Patchlevel 3"
    How do I install the adobe LifeCycle designer?

    hello,
    Please try uninstalling and reinstalling the GUI
    a) Remove all SAP components via "Control panel", this is very
         important
    b) Install SAP GUI
    c) Install latest GUI Patch
    You can download these patches from the following url.
    Apply GUI 7.10 patch  from the following url,
    Goto URL: http://www.service.sap.com/swdc
    SAP Software Distribution Center -> Download -> Support Packages and
    Patches -> Entry by Application Group -> SAP Frontend Components ->
    SAP GUI FOR WINDOWS -> SAP GUI FOR WINDOWS 7.10 CORE -> win32 ->
    regards,
    John Feely

  • 'operator + cannot be applied to double'

    public double getTotalPrice() {
            if (orderItems.size() == 0) {
                return 0.0;
            double total = 0.0;
            for (Iterator it = orderItems.iterator(); it.hasNext();) {
                OrderItem oi = (OrderItem) it.next();
                 total += (oi.getCost()).multiply(BigDecimal.valueOf(oi.getPurchaseQty()));
            return total;
    }ive got this method here and this part's got an error:
    total += (oi.getCost()).multiply(BigDecimal.valueOf(oi.getPurchaseQty()));Error: operator + cannot be applied to double, <any>
    any help is appreciated. thx

    What type does this return?
    (oi.getCost()).multiply(BigDecimal.valueOf(oi.getPurchaseQty()))At a glance, I'd guess BigDecimal. You can't use arithmetic operations like + on BigDecimal. You'd have to call its doubleValue method, or whatever there is that returns a double. Of course, since BigDecimal can hold numbers that double can't, that could give you bogus values, so you really need to make total a BigD as well, and call BigD's methods in place of +=, or else stick to numbers that fit in a double and don't use BigD at all.

  • Weblogic.servlet.jsp.StaleChecker cannot be applied

    Hi,
    I am getting the following error when i try to access the web application deployed
    on the weblogic 8.1 sp2 application server. The same works fine on weblogic 7.1.
    Please let me know if any of you came across this problem.
    C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_rttm_rttm\jsp_servlet\__login.java:49:
    isResourceStale(java.lang.String,long,java.lang.String) in weblogic.servlet.jsp.StaleChecker
    cannot be applied to (java.lang.String,long,java.lang.String,java.lang.String)
    (No more information available, probably caused by another error.
    Thanks in advance
    -Nagaraju

    May be the weglogic.jar used in your web application is differ with the current
    bea home's.
    "Nagaraju" <[email protected]> wrote:
    >
    Hi,
    I am getting the following error when i try to access the web application
    deployed
    on the weblogic 8.1 sp2 application server. The same works fine on weblogic
    7.1.
    Please let me know if any of you came across this problem.
    C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver_rttm_rttm\jsp_servlet\__login.java:49:
    isResourceStale(java.lang.String,long,java.lang.String) in weblogic.servlet.jsp.StaleChecker
    cannot be applied to (java.lang.String,long,java.lang.String,java.lang.String)
    (No more information available, probably caused by another error.
    Thanks in advance
    -Nagaraju

  • Re: cannot be applied to (double,java.lang.String)

    It's telling you what the problem is -- you're trying to pass a String in where a double is required. Java is a strongly typed language, which means that you can't expect types to change automatically into other types as needed.
    You could, I suppose, parse the string, assuming that it holds a representation of a double. But if you look at the method in question, you'll see that it doesn't even use its second (double) argument.
    So you should ask yourself:
    1) should that method really take two arguments?
    2) what is the second argument for, if I did use it?
    3) what is the best type to represent the second argument?
    (hint: with a name like "customerType", then an enum seems likely)
    [add]
    Too slow again.
    Though I'll also add: please wrap any code you post in [code][/code] tags. It makes your code much easier to read.
    Message was edited by:
    paulcw

    >  String n ;
    n = JOptionPane.showInputDialog(null, "Enter Month No.:");
    pow(double,double) in java.lang.Math cannot be
    applied to (double,java.lang.String)Read the error diagnostic carefully: the compiler found a pow() method
    in the Math class, but it takes two doubles as its arguments. You,
    however, supplied a double and a String as the parameter types.
    The method found by the compiler cannot be applied to your parameters.
    hint: you have to convert that String to a double,
    kind regards,
    Jos

  • String cannot be applied to java.lang.String in NetBeans 6 !?!?

    Guys,
    I have a problem. I am calling some API from jar file. Here is the method prototype in API jar:
    public Operator getAdminOperator(String name, String password, int admin);
    when I call this method in NetBeans 6 like the following:
    admin.getAdminOperator(userName, password, 1);
    where userName and password are both string, I get the following error:
    getAdminOperator(String, String, int) in common.admin.AdminRemote cannot be applied to (java.lang.String, java.lang.String, int)
    WTF?!?! If i try the same code in NetBeans 5 it works, and it works in JavaStudioCreator, but NetBeans 6 does not takes it! And because of this error, I am not able to see the Design view in the JSF! The code compiles just fine and runs if I deploy it in the server though, but i need to see the Design view.
    ANY ideas what is going on?

    Then this "String" class must be some other class and not java.lang.String. Did you write the API in question? Does it have a "String" class in one of its namespaces? Or perhaps you wrote a class named "String" and didn't put it in a package? If that's not the case, then contact the writer and ask them.

  • A filter cannot be applied to the currently selected field. Select a different field

    Hi,
    I am using an InfoPath form to submit the data. In my form I am using one dropdown and one textbox in a repeating table, and the data is fetching from the SharePoint list.
    Scenario: In my SharePoint list there is a column of Company name and other is of Focal Point name. In dropdown contains the company name column.
    I want the functionality that when i select the Company name the associated focal point name should appear in the textbox.
    To achieve this I am using the filter for dropdown but it is showing me error "A filter cannot be applied to the currently selected field. Select a different field."
    Can anyone please tell me how can I do this.
    Thanks in Advanced,

    Hi,
    Please update me any solution for this as I am not able to resolve this.....
    Thanks,

  • Error messages!  area(double, double) cannot be applied to ( )

    I keep getting these error messages:
    area(double,double) in Rectangle cannot be applied to ()
              return "Area: " + Rectangle.area() + "\tCircumference: " + Rectangle.perimeter(); ^
    perimeter(double,double) in Rectangle cannot be applied to ()
              return "Area: " + Rectangle.area() + "\tCircumference: " + Rectangle.perimeter();
    ^
    setSides(double,double) in Rectangle cannot be applied to (double)
              R.setSides(input.nextDouble());
    ^
    3 errors
    Tool completed with exit code 1
    Can anybody tell me why it is doing this? Thanks in advance!
    import java.util.Scanner;
    public class Rectangle
         public double length;
         public double width;
         public Rectangle()
              length = 0;
              width = 0;
         public double getSides()
              return length;
              return width;
         public void setSides(double length, double width)
              this.length = length;
              this.width = width;
         public double area(double length, double width)
              double area = length * width;
              return area;
         public double perimeter(double length, double width)
              double perimeter = (length * 2) + (width * 2);
              return perimeter;
         public String toString()
              return "Area: " + Rectangle.area() + "\tCircumference: " + Rectangle.perimeter();
         public static void main(String [] args)
              Rectangle R = new Rectangle();
              Scanner input = new Scanner(System.in);
              System.out.println("Enter radius: ");
              R.setSides(input.nextDouble());
              System.out.println(R.toString());
    }

    Looking at your code more, it looks like what you want to do when you call area is get the area of the Rectangle based on the length and width it already has stored, not what you pass it. So if you take out the parameters like this:
    public double area() {
         double area = length * width;
         return area;
    }It will use the member variables length and width to calculate area.

Maybe you are looking for

  • Open Hyperlink in new window in PDF output

    Iam using Word2003 for building templates and inserted a static hyperlink. When i click on the link in report o/p, the link is opened in same window. How to make this open in new window? I followed Tim Dexter's blog http://blogs.oracle.com/xmlpublish

  • Error In release of Purchase Requisition

    Hi All, In Development Client PR release strategy is working fine but when iam testing in testing client PR release startegy is not working. I have created class and characteristics before transporting the rel groups but when i checked i am getting e

  • Safari Crash - Safari won't start for specific user

    Hi all, for a specific user on the system Safari won't start, the crash report is pasted below. Safari starts up fine for the Guest account and admin accounts. The user in question has a network home folder mounted on our server using AFP - not sure

  • RAW import parameters in external service

    Hi all, I'm extending an application that has been written by somebody else. I need to connect to an RFC using CAF external services. In this RFC one of the input parameters (GUID) is of the type RAW. When I import an external service (based on this

  • .mov issues in FCE HD (urgent!)

    I really hope someone can help me out tonight, I'm editing a video for a contest my school is entering, and the deadline is tomorrow - I'm basically letting the whole school down if I don't get this in, so yeah in a bit of a panic right now... Here's