Implementing Comparable interface? Help please.

Why am I getting the following error?
Exception in thread "main" java.lang.ClassCastException: java.lang.Double cannot be cast to chapter10.RectangleJust look at the test class and ComparableRectangle class if you can find the bug.
Here are the 3 of 4 classes:
package chapter10;
public class TestComparableRectangle {
    public static void main (String[] args) {
        ComparableRectangle area1 = new ComparableRectangle(3.0, 6.0);
        ComparableRectangle area2 = new ComparableRectangle(5.0, 4.0);
        int result = area1.compareTo(area2.getArea());
        if (result == -1)
            System.out.println("area1 " + area1.getArea() + " < "
                    + area2.getArea() + " area2.");
        else if (result == 0)
            System.out.println("area1 " + area1.getArea() + " = "
                    + area2.getArea() + " area2.");
        else
            System.out.println("area1 " + area1.getArea() + " > "
                    + area2.getArea() + " area2.");
package chapter10;
public class ComparableRectangle extends Rectangle implements Comparable{
    /** Construct a ComprableRectangle with specified properties */
    public ComparableRectangle(double width, double height) {
        super(width, height);
    /*  Implement the compareTo method defined in Comparable */
    @Override
    public int compareTo(Object x) {
        if (getArea() > ((Rectangle)x).getArea())
            return 1;
        else if (getArea() < ((Rectangle)x).getArea())
            return -1;
        else
            return 0;
package chapter10;
public class Rectangle extends GeometricObject {
    private double width;
    private double height;
    public Rectangle(){
    public Rectangle (double width, double height) {
        this.width = width;
        this.height = height;
    // Return width
    public double getWidth () {
        return width;
    // Set a new width
    public void setWidth (double width) {
        this.width = width;
    // Return height
    public double getHeight () {
        return height;
    public void setHeight (double height) {
        this.height = height;
    // Return area
    public double getArea () {
        return width * height;
    //Return parimeter
    public double getPerimeter() {
        return 2 * (width + height);
}Thanks in advance.

Thanks a lot friend. It has been a week I've been trying to find the problem. In fact I was adding/casting the left side, but never tried the right side.
This is what I changed it and it worked.
int result = area1.compareTo(area2);Thank you.

Similar Messages

  • Trying to implement comparable interface

    I am writing a Book class, and in the class header I have stated the implements Comparable. I also have defined the public int compareTo( Book rhs). When I compile the Book class. I get the following message. The Book class needs to be abstract.
    I cannot create an object from an abstract class. What am I doing wrong?
    Ray

    You have maybe not implemented all methods in the interfaces you are using in your Book class. Are you using any other interface than Compnarable? Do you get any other error message?
    Anyway, this works when adding the Comparable interface, add this method to your Book class:
    public int compareTo(Object o) {
    return this.toString().compareTo(o.toString());
    And this method:
    public String toString() {
    return bookName; // Or anything that represents your book (for comparing)

  • Interface help please

    Hello,
    Am logic 7.1- PM g5 user.
    Earlier I got some good advice from Rohan (on this group) and have narrowed my choice of an audio interface down to RME fireface or Metro Halo. He also ofilled in another I had about recording from them. So, now just to choose one device in particular. I am using m-audio now -1814 and have no compatibility issues. WOuld like to keep that but want to upgrade the unit primarily for better converters.
    So, please any suggestions based on knowledge or experience will help greatly.
    Best,
    Doug

    MH stuff is really good, if you need alot of gain from a 2882 it will get noisy. I have little problems on recordings with high SPLs (like drum kits)-converters, support and drivers are all great. No complaints. ULN2 is the same conversion with great pres. Can't go wrong with either unit, IMO. I love their portability and sound. Think of them as a RME/Motu traveler. If mobility is no issue then RME would typically be the better choice.

  • Using the Comparator Interface.Please Help.

    Hello there,
    I am trying out this example regarding the Comparator Interface.
    It works fine, but I havent really understood this at all.
    It deals with reverse sorting.
    import java.util.*;
    class MyComp implements Comparator {
    public int compareTo(Object a,Object b)
    String aStr,bStr;
    aStr = (String)a;
    bStr = (String)b;
    return bStr.compareTo(aStr)
    class MyComparator {
    public static void main(String[] args) {
    // Create a Tree Set
    TreeSet ts = new TreeSet(new MyComp());
    ts.add("C");
    ts.add("A");
    ts.add("P");
    ts.add("Z");
    ts.add("B");
    System.out.println(ts)
    Output : [Z, P, C, B, A]
    I have not understood the following at all:
    1) We are implementing the Comparator Interface in class MyComp.
    Now where is this being called in the MyComparator class?
    2) How is the reverse sorting taking place.?
    How is this comparing the different instances of the MyComparator class
    when I havent even instantiated the MyComparator class ?
    3) How is the interface method compare To(Object a,Object b) being invoked?
    Please can some please answer my questions.
    Regards

    class MyComp implements Comparator {
    public int compareTo(Object a,Object b)
    String aStr,bStr;
    aStr = (String)a;
    bStr = (String)b;Your reverse ordering is happening here.
    If you were to write
    return aStr.compareTo(bStr)
    the ordering would be in normal order.
    >
    return bStr.compareTo(aStr)The comparator that the treeSet uses is declared and instantiated here
    TreeSet ts = new TreeSet(new MyComp());
    1) We are implementing the Comparator Interface in
    class MyComp.
    Now where is this being called in the MyComparator
    or class? The comparator is being used by the TreeSet to order your entries
    >
    >
    2) How is the reverse sorting taking place.?Explained above. For further explaination look up comparator and String.compareTo()
    How is this comparing the different instances of
    of the MyComparator class
    when I havent even instantiated the MyComparator
    or class ?Also explained above
    3) How is the interface method compare To(Object
    a,Object b) being invoked?Internally by the TreeSet
    I hope this helped a little

  • SQLData interface help required please

    Hi,
    i need some help with the following problem.
    I have an object with a lot of data elements (100ish), some of them scalar (varchar2's etc), some are "type table of varchar2" and some are "type table of sql_object". I want to write a java stored procedure (SQLData interface?) that can update the values in this object.
    I can, of course, populate the values from pl/sql no problem BUT as im populating the data values from a large XML source (i.e. multiple xpath operations) it takes time in pl/sql (takes abount 1 sec which is too long for our buisness need here). I am attributing to slowness due to the large amount of context switches from pl/sql to java).
    i have tried making a small sample object to prove the concept of the SqlData in dealing with objects that have nested objects and arrays but i am getting problems in getting it to work with nested objects!.
    my noddy example:
    ------------------- inner.java ---------------
    import java.sql.*;
    import java.io.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.oracore.*;
    import oracle.jdbc2.*;
    import java.math.*;
    public class inner implements SQLData {
    // Implement the attributes and operations for this type.
    private BigDecimal id;
    public String name;
    public static void wages(inner e[]) {
    e[0].name = "55"; // just update the name element to prove the point.
    // Implement SQLData interface.
    private String sql_type;
    public String getSQLTypeName() throws SQLException {
    return sql_type;
    public void readSQL(SQLInput stream, String typeName)
    throws SQLException {
    sql_type = typeName;
    id = stream.readBigDecimal();
    name = stream.readString();
    public void writeSQL(SQLOutput stream) throws SQLException {
    stream.writeBigDecimal(id);
    stream.writeString(name);
    ------------------- outer.java ---------------
    import java.sql.*;
    import java.io.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.oracore.*;
    import oracle.jdbc2.*;
    import java.math.*;
    public class outer implements SQLData {
    // Implement the attributes and operations for this type.
    private BigDecimal id;
    private String name;
    public inner inn;
    public static void wages(outer e[]) {
    e[0].name = "54";
    e[0].inn.name = "55";// just update the name element to prove the point.
    // Implement SQLData interface.
    private String sql_type;
    public String getSQLTypeName() throws SQLException {
    return sql_type;
    public void readSQL(SQLInput stream, String typeName)
    throws SQLException {
    sql_type = typeName;
    id = stream.readBigDecimal();
    name = stream.readString();
    inn = (inner)(SQLData)stream.readObject();
    public void writeSQL(SQLOutput stream) throws SQLException {
    stream.writeBigDecimal(id);
    stream.writeString(name);
    stream.writeObject((SQLData)inn);
    SQL> drop type outer
    2 /
    Type dropped.
    SQL> create or replace type inner as object(
    2 id number(20),
    3 name varchar2(2000)
    4 );
    5 /
    Type created.
    SQL> create or replace type outer as object(
    2 id number(20),
    3 name varchar2(2000),
    4 inn inner
    5 );
    6 /
    Type created.
    SQL> drop procedure wages
    2 /
    Procedure dropped.
    SQL> CREATE OR REPLACE procedure wages (e in out inner) AS
    2 LANGUAGE JAVA
    3 NAME 'inner.wages(inner[])';
    4 /
    Procedure created.
    SQL> CREATE OR REPLACE procedure wages2 (e in out outer) AS
    2 LANGUAGE JAVA
    3 NAME 'outer.wages(outer[])';
    4 /
    Procedure created.
    SQL> declare
    2 i inner := inner(1,'ee');
    3
    4 begin
    5 dbms_output.put_line(i.name);
    6 wages(i);
    7 dbms_output.put_line(i.id||';'||i.name); -- should have changed the name element
    8 end;
    9 /
    ee
    1;55
    PL/SQL procedure successfully completed.
    SQL> declare
    2 i inner := inner(1,'ee');
    3 o outer := outer(1,'ee2', i);
    4
    5 begin
    6 dbms_output.put_line(o.id||';'||o.name||';'||o.inn.name);
    7 wages2(o);
    8 dbms_output.put_line(o.id||';'||o.name||';'||o.inn.name);-- should have changed the INNER name element
    9 end;
    10 /
    1;ee2;ee
    declare
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected IN Conversion failed
    Note all wanted to do in the "inner" example is change the value of name...this worked as expected. In the second example i wanted to change the value of my inner objects name value...this fails with IN conversion failed.
    I would be grateful if someone could tell me if this kind of operation is supported in SQLData? (or perhaps another way of doing it?).
    im my REAL object its even more complex as i have stuff like:
    -- nested types...
    type varchar2_tab is table of varchar2(4000);
    type product is object (
    id number(1),
    name varchar2(200)
    type products is table of product;
    -- my main type that i want to perform java ops on
    type my_main_obj is object(
    id number,
    name varchar2(2000),
    array1 varchar2_tab,
    prod products,
    ........lots more elements of the above kinds
    and its on my_main_obj that i want to run a Jproc to populate my variables.
    the kind of pl/sql code thats doing this, at the moment, is:
    -- scalar types.........
    outstCplntInd := xpath_utilities.valueOf(r_dom_node,'outstCplntInd');
    -- scalar array types.....
    xpath_utilities.valueof(r_dom_node, 'names/name',
    p_array_in_out => names);
    -- and object array types.......
    r_dom_node_list := spg_xpath_utilities.selectNodes(r_dom_node,
    'bills/bill');
    for idx in 1..sys.xmldom.getlength(r_dom_node_list)
    loop
    if (prods is null)
    then
    prods := products(null);
    else
    prods.extend;
    end if;
    prods(prods.last) := product(
    xpath_utilities.valueof(
    xmldom.item(r_dom_node_list,idx-1), 'prodTyp'),
    xpath_utilities.valueof(
    xmldom.item(r_dom_node_list,idx-1),
    'prodSerNr'),
    xpath_utilities.valueof(
    xmldom.item(r_dom_node_list,idx-1),
    'prodDate'));
    end loop;
    ....etc
    (the xpath_utilites pacakge is a helper package i got out of Steve Muenchs oracle XML book).
    Thanks for any suggestions!
    Daz.
    Oracle version 8.1.7.4 with the latest java + pl/sql XML XDKs installed.

    Hi AM_Kidd.
    Thanks for your reply.
    I have done a complete uninstall and re install of iTunes and all related apple programs from my laptop through control panel, add remove programs and also by going through program files and deleting all tracers of any left over folders remove programs may have missed.
    My apologies for forgetting to add this in my original post.
    Thanks again

  • Last Project -- Need Help, Please

    Okay, this is my last project, and I am struggling with it. The specification we were given was to write a program that reads in a file of dates and outputs the dates in descending order, using a priority queue. The PriorityQueue should implement the PriorityQueueInterface interface, and should implements a priority queue using a singly linked list. The list should be maintained in sorted order. This implementation should not use a heap.
    I have the code built, but when I run it is not reading my dates fully, and I get an error message. The LinkList is already built for us, but here is the rest of my code. First I input from my dates.txt:
    11/12/2000
    04/04/2004
    01/02/1998
    import java.io.*;
    public class DateDriver {
       public static void main(String[] args) throws IOException {
          PriorityQueue pq = new PriorityQueue();
          // ... read all Date objects from the file and enqueue them in the pq object
          BufferedReader in = new BufferedReader (new FileReader("C:/Users/April/Desktop/UMUC/CMIS241/Project4/Dates.txt"));
          Date date = new Date();
          date.input(in);
          while (!date.isNull()){
               pq.add(date);
               date = new Date();
               date.input(in);
               System.out.println(date);
          // ... dequeue the pq object and display the Date objects
          System.out.println("The dates in descending order are: ");
          while (!pq.isEmpty()){
               date = (Date) pq.dequeue();
               date.output(System.out);
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.PrintStream;
    public class Date implements InOutputable, Comparable {
       // ... define monthNames as a ?static final? array of String objects
       //  initialize the array with the first 3 characters of each month
         static final String[] monthNames = {null, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
              "Oct", "Nov", "Dec"};
       // ... define the instance variables of class Date, i.e. day, month, year
         private String monthAbr, date;
         private int month, day, year;
       // ... define the default constructor (initializes the instance variables to zero)
         public Date(){
              this.date = "";
              month = 00;
              day = 00;
              year = 0000;
       // ... define the method toString
       //     This method should return the corresponding Date string in the following format: Nov, 11, 2006
         public String toString() {
               return (monthAbr + ", " + day + ", " + year);
       // ... define the methods specified by the interface InOutputable
    public boolean equals(InOutputable other) {
         Date otherDate = (Date) other;
         if (month == otherDate.month && day == otherDate.day && year == otherDate.year)
              return true;
         else
              return false;
    public void input(BufferedReader in) throws IOException {
         date = in.readLine();
         if (date == null)
              return;
         month = Integer.parseInt(date.substring(0, 2));
         day = Integer.parseInt(date.substring(3, 5));
         year = Integer.parseInt(date.substring(6, 10));
    public boolean isNull() {
         if (month == 0 && day == 0 && year == 0)
              return true;
         else
              return false;
    public void output(PrintStream writer) {
         writer.println(toString());
       // ... define the method specified by the interface Comparable
    public int compareTo(Object o) {
         Date otherDate = (Date) o;
         if(month == otherDate.month && day == otherDate.day && year == otherDate.year)
              return 0;
         else if (month >= otherDate.month && day >= otherDate.day && year >= otherDate.year)
              return 1;
         else
              return -1;
    public class PriorityQueue implements PriorityQueueInterface {   
       private RefSortedList lst = new RefSortedList();
       // ... define the methods specified by the interface PriorityQueueInterface
    public Comparable dequeue() throws EmptyQueue {
         return null;
    public void enqueue(Comparable key) throws FullQueue {
    public boolean isEmpty() {
         return false;
       // ... Use the lst object (by invoking list specific methods on it) when
       //     defining the PriorityQueueInterface methods.
       //     For example, method enqueue should be implemented by invoking list method add.
    public void add(Date date){
         lst.add(date);
    public void remove(Date date){
         lst.remove(date);
    }My output:
    Exception in thread "main" java.lang.NullPointerException
         at DateDriver.main(DateDriver.java:27)
    null, 4, 2004
    null, 2, 1998
    null, 0, 0
    The dates in descending order are:
    Can anybody please point me in the right direction? I know I am missing something, but I am unable to pinpoint it. I don't understand why the date.output(System.out) is throwing a null pointer exception. I am still working, but I thought maybe a fresh pair of eyes would help me.

    Dates implement Comparable... no need to sort them yourself
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    LinkedList<Date> dtes = new LinkedList<Date>();
    BufferedReader in = new BufferedReader (new FileReader("C:/dates.txt"));
    while (in.read()>0){
    dtes.add(sdf.parse(in.readLine()));
    }Edited by: wpp289 on Dec 11, 2008 1:27 PM

  • Abstract Class that implements Comparable

    I am trying to understand how a comparable interface works with an abstract class. Any help is greatly appreciated.
    I have a class ClassA defined as follows:
    public abstract class ClassA implements Comparable I have a method, compareTo(..), within ClassA as follows:
    public int compareTo(Object o) I have a sub-class ClassB defined as follows:
    public class ClassB extends ClassAI am receiving a compile error:
    Class must implement the inherited abstract method packagename.ClassA.compareTo(Object)
    Should or can the compareTo be abstract in ClassA and executed in ClassB? Just not sure how this works.

    ???? if you are inheriting from an abstract class your subclass must implement methods that were declared in the parent (abstract) class but not implemented
    When in doubt, refer to the Java Language Specification..

  • Comparable and comparator interface in java

    Hi All,
    How comparable and comparator interface works in java and when to use comparable and when to use comparator.please give me some example(code) as I am not able to understand the difference.
    Thanks
    Sumit
    Edited by: sumit7nov on May 17, 2009 4:45 AM

    Thanks,one more doubt.
    We have Collections.sort() method and we can sort any list by this method without implementing comparable or comparator interface.Then my question is when we need to implement comparable or comparator interface or when do we write our own compareTo() or compare() methods.
    Thanks
    Sumit

  • How to get classes which implement the interface in program

    Hi,
    I created an interface and some classes are implementing it. I want to know in which classes the interface is implemented through program. I mean in which table the interface implemented details stores.
    please helps regarding this.
    Thanks,
    Regards,
    Priya

    Hi.,
    Read the  database view VSEOIMPLEM with where condition.,  REFCLSNAME =  <Interface Name> and Version = 1.
    This gives the class names which implement the interface.,
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • Implementing comparable for a TreeMap

    I'm trying to create a League of Players which is ordered by the player grade, but the comparism method (compareTo) doesn't seem to be getting called. The following list should be displayed in grade order
    RANK LIST
    950 Alactaga
    1000 Aragorn
    1000 Black Jack II
    950 Brius
    1100 Fitzchev
    1150 Heraldo
    950 Horace
    900 Killer Giraffe
    I have 3 main classes involved: Player, Players, League
    public class Player implements Comparable {
         private static final int START_GRADE = 1000;
         private String name;
         private int grade;
          * Constructor
          * Note that the constructor is private to ensure that
          * only one unique version of each player can exist.
         private Player(String name) {
              this.name = name;
              this.grade = START_GRADE;
         public int compareTo(Object o) {
                   System.out.println("Comparing!!");
                 Player n = (Player)o;
                 int gradeComp = new Integer(grade).compareTo(new Integer(n.grade));
                 return gradeComp;
          * Factory method for creating a new player
         public static Player create(String name) {
              return new Player(name);
    public class Players extends TreeMap {
          * Constructor
         public Players() {
              loadPlayers();
          * Load the players
          * These could come from a file or a database.
         private void loadPlayers() {
              // Some hard-coded stuff for testing
              this.put("Black Jack II", Player.create("Black Jack II"));
              this.put("Fitzchev", Player.create("Fitzchev"));
              this.put("Brius", Player.create("Brius"));
         public Player getNamed(String name) {
              return (Player) get(name);
    public class League extends Players {
         private static final int DELTA = 50;
          * Main routine for recalculating rankings based on a given game
         public void scoreGame(Game game) {
         }I followed the following tutorial item to get me started:
    http://java.sun.com/docs/books/tutorial/collections/interfaces/order.html
    Thanks for any help!

    Thanks for the help. The toString() function of the League class now begins as follows:
          * Create a string version of the ranked list
         public String toString() {
              String rankListString = "";
              rankListString += "RANK LIST\n";
              rankListString += "---------\n";
              Collection players = this.values();
              Players[] playersArray = (Players[]) players.toArray();
              Comparator myComparator = new Comparator() {
                   public int compare(Object o1, Object o2) {
                        int comp;
                        System.out.println("Comparing!!");
                        Player p1 = (Player)o1;
                        Player p2 = (Player)o2;
                        if (p1.getGrade() < p2.getGrade()) {
                             comp = -1;     
                        else if (p1.getGrade() > p2.getGrade()) {
                             comp = 1;
                        else {
                             comp = 0;
                        return comp;
              Arrays.sort(playersArray, myComparator);At the moment though I have a ClassCastException on the following line:
    Players[] playersArray = (Players[]) players.toArray();          java.lang.ClassCastException
         at core.League.toString(League.java:65)
         at java.lang.String.valueOf(Unknown Source)
         at java.io.PrintStream.print(Unknown Source)
         at java.io.PrintStream.println(Unknown Source)
         at main.Grape.main(Grape.java:37)
    Exception in thread "main"
    I'm still a bit of a newbie as you can see. Any help would be appreciated. Thanks!

  • Comparable interface selection sort

    Hi,
    I've created a Person Class with a comparable interface. And i've created an ArrayList People with varaibles from the person class in - First_name, Surname, Month(Birthday), Day(Birthday).
    Now i need to use selection sort to sort my arraylist into birthday order. In the Person Class i have a method which gives each person a different number for every possible birthday there is.
    I have created a selction sort but dont know how to call the birthday from my array list and then to sort it.
    This is my code for the selection sort so far:
    import java.util.ArrayList.*;
    public class Main
    public static void selectionSort(Comparable[] people)
    for (int k = people.length-1; k>0; k --)
    Comparable tmp;
    int Large = 0;
    for (int j=1; j<= k; j++)
    if (people[j].compareTo(people[k]) <0)
    Large = j;
    tmp = people[Large];
    people[Large] = people[k];
    people[k] = tmp;
    this method compiles but i need to sort the birthday and dont know how. Also i need to output the whole array in birthday order.
    Any help would be very greatful.
    Thanks
    Dave

    Hi,
    If my understanding is right..
    You are trying to sort with birthday as the primary sort criterria.
    For doing that, you have to write the comparison logic inside the compareTo() method implemented in the Person class (Inherited from Comparable Interface).
    i.e. The compareTo() method should use the the primary_sort_variable(here it is birthday or something derived from it) to return a boolean value for your need.

  • Must implement specifik interface

    Hi,
    Im creating a game to force myshelf to code a game-engine, just for fun. In this game I have superclass for a basic unit. This class gets subclassed down to game-units. I have different type of game units, some more advanced than others (my game idea is like a manager game where choose between units similar to warcraft 3 units).
    To help the game-engine separate between the different type of units and the methods that can be used on them, I want to use differtent interface for the advanced units. This could be the start of the Wizard-class:
    public class Wizards extends BasicUnit implements SpellCaster {
    // method and variables that are specific for a wizard and dont excist in BasicUnit
    }Question is: How can I force a method in the game-enginge class to look if a used unit implements a certain interface, in this case the SpellCaster-interface?
    I know it should be possible, like the Comparable Interface. But how do i do it?
    If its a dumb question a link to the specifik documents would do, I read it myshelf. But of course I would be happy if someone have the kindness to write an example. Again, this aint homework, just a fun x-mas project for me.

    Ani_Skywalker wrote:
    Hi again Jverd,
    I google [visitor pattern|http://en.wikipedia.org/wiki/Visitor_pattern] and through that I also find [virtual function|http://en.wikipedia.org/wiki/Virtual_functions] . I can see how its usefull in this issue.
    Thought my main concern for the moment is about [composition over inheritance|http://blogs.msdn.com/steverowe/archive/2008/04/28/prefer-composition-over-inheritance.aspxI]. This is not what we learned in school when I took my first and second java courses. But I think the composition over inheritance strategy seems very sensible.
    jverd wrote:
    I don't really know your whole picture, but one option is to define a type that has those particular operations in common, and pass that type around when that's what you need. The subclasses could inherit from a base class that provides those, or implement an interface, and then add their own methods.But this is exactly what my class BasicUnit does. Maybe my english is bad and I misslead you, or maybe I should pick a better name for that class, like Unit. But what it does is to hold methods that every unit in the game use. Subclasses that need more methods adds that. The way you wrote your example is kind of how I've done it, as it seems to me. Could you tell me were you think I do wrong?It may have just been a misunderstanding on my part, as I don't know you and I don't know your requirements or the details of how you're implementing them.
    Or it may be that you're kind of close to doing it correctly, but not quite. The situation I described as a good approach can look a lot like the not-so-good way I thought you were doing it. I'm kind of sleep-deprived right now, so I don't have the energy or brainpower to go into any more detail at the moment.
    Good luck though. I expect somebody will continue helping you if you keep working at it.

  • Sorting a Vector.Can some one help please?

    Folks,
    How do I sort the elements in a Vector?
    If I have a vector containing different names,
    how can sort this out in ascending order?
    Please can any one send in a small example that I can
    modify to suit my requirments.
    Thanks
    Ajay

    u can only sort objects which implements the Comparable interface. the compareTo() method compares between 2 objects and returns a integer ranging from -1 to 1. -1 means smaller, 0 means equal and 1 means greater.
    you just have to follow your sorting algorithm, no extra changes needed. most classes implement the Comparable interface. if they dont, you can implement the interface yourself and override the compareTo() method.

  • How can my web service class implement an interface

    I am not able to write :
    webserviceclass implements interface
    I am using servicegen script to convert java file to the web service.But then also,if i add
    javaClassComponents="javaclass1,interface1"
    It is saying interface1 does not have any no arg constructor,so can't used in the web service.
    kindly tell how can i code my web service to implement an interface.

    This forum focuses on end-user support. You can find more web development help on the [http://forums.mozillazine.org/viewforum.php?f=25 mozillaZine Web Development board]. Separate forum, separate registration. Please note the tips in the Sticky Post at the top of the forum before posting.
    That said... Firefox honors the setting autocomplete="off" in the form tag. When this attribute is set, users should not be prompted to save the username/password, and it should not be filled automatically. (Is this what wasn't working??)
    https://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion
    Knowledgeable users can bypass this setting by running a script to strip this attribute. I doubt that very many users would do that, but if people have to log in very frequently, it is more likely to happen. Users also may use add-ons that manage passwords, and those add-ons might not honor the autcomplete="off" setting. I haven't used any such add-ons, so I don't know the situation there.
    I'm sure this isn't completely satisfactory but hopefully it helps to some extent.

  • Photoshop Elements 6 on Mac help please !!!!!

    Hi there,
              I need help please !!!!!
    I have PSE 6 for my imac and bought myself a NIKON D60 so far so good. I have installed PSE 6 which comes with ADOBE Bridge CS3
    I have bought a book as well as I am new to photoshop and in fact DSLR cameras.
    I have got my photos into Bridge OK by the way they are JPEG format. According to the book I can open the JPEG in camera RAW by either selecting the JPEG and then pressing cmd+R or by selecting the JPEG and select open with and camera RAW should be available to selct.
    I cannot get of the options to work any ideas please
    Secondly I have taken some photos in RAW format and put then into Bridge again I cannot get the camera RAW interface to open with these neff images.
    If I try to open the image PSE 6 opens and gives me an error that the file format is not supported by PSE 6
    Am I missing something here as I have been trying for a week now !!!!!
    Sorry if this comes across a stupid question but it is new to me
    Chris      UK

    There's no "theory" about it. You should be able to open a raw file from bridge by double-clicking it, but it will open in ACR in PSE. You can't just use ACR within bridge in PSE, if that's what you're trying to do. To open a JPEG in ACR, go to file>Open in PSE and choose Camera raw as the format after you select the file but before you click Open.
    If you've correctly updated ACR, bridge should show you thumbnails of your raw files. If it doesn't try emptying the Bridge cache.

Maybe you are looking for

  • How to Edit Creative Cloud for Teams 'Team Name' inAdmin Console?

    I have multiple VIP agreements in my CC Admin Console, with very similar names. Can I edit these Team Names to make it easier to differentiate between them? If so, how? Many thanks in advance for any help or advice you can provide. Adam

  • Variable not found in class - Newbie

    public void executeSearch() { try { File startSearchDir = new File(directory); } catch (NullPointerException npe) { System.out.println("The file path entered is not valid."); return; File [] fileArray = startSearchDir.listFiles(); Why is the startSea

  • ITunes 7.1 wll not recognize my IPod name - Skips songs

    ITunes 7.1 wll not recognize my IPod name, says shared. - Skips songs that you pick to play. When plugging in my IPod, iTunes 7.1 wll not recognize my IPod name, says shared. I get a message saying "The shared music library 'ABC' is not compatable wi

  • Using ESS with Portal 7.0 and backend ECC 5.0.  Why not?

    Hi, I have this landscape: server A: Portal 7.0 in WAS 7.0 (2004s) with BP ESS and XSS components server B: backend ECC 5.0 with EA-HR SP38. But I am having problems to run some ESS webdynpro iViews (specially personnel info); According this note: 10

  • Adobe User Manual for Elements 6 for Mac

    Good afternoon, Can anybody help me and tell where i would a downloadable version of the Photoshop Elements 6 for Mac User Manual please.  I have (somehow) found and downloaded the PC version when i was trialling Elements on my Windows Laptop but can