Equals() compares objects or references?

My question concerns the equals( ) method from Object Class.
I have read in book by Bruce Eckel "Thinking in Java" that this method by
default compares references to objects.
On the other hand in API Specification ver. 1.3.1 it is stated as quoted :
"The equals method for class Object implements the most discriminating
possible equivalence relation on OBJECTS;... ."
I believe that API Specification can't contain mistakes but may be there is
something that i don't understand about it?
Thanks for any feedback.
adam320

"The equals method for class Object implements the
most discriminating
possible equivalence relation on OBJECTS;... ."... which means that it compares the references to the objects. If the references are different, the objects are not equal according to this method.    Object a = new Object();
    Object b = new Object();
    System.out.println(a.equals(a)); // true
    System.out.println(a.equals(b)); // false

Similar Messages

  • Comparing objects for equality with UDT's

    Hi.
    I was wondering how Oracle does comparison for equality of objects that contains parameters of user defined types.
    Suppose I have an object with a parameters whose types are:
    1) number,
    2) varchar2,
    3) nested table type,
    4) associative array
    and I want to compare two such objects for equality. Would Oracle compare all parameters of this 2 compared objects field-by-field (and dig recursive to "leafs"), or would it compare only 1), 2) and doas nothing with 3) and 4)?
    Must I declare an order method for such comparison?

    You didn't specify a version - this is correct for 10.2, I'm not sure if it has changed in 11g.
    By default it will compare for exact equality - i.e that every attribute is the same. You can also only do it in SQL, not PL/SQL. Also can only do = and <> - you cannot do < or > etc.
    You need to create a MAP or ORDER method on the type to do any more sophisticated comparison (Same as in most object oriented languages). Documentation is here http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14260/adobjbas.htm#sthref211

  • Help comparing objects

    Hi,
    My java app's purpose is to find out if I must update my simulated framework if the real framework has changed ( interfaces).
    My app loads two jar files ( real framework and simulated framwork) and use bcel to make an static analysis of the classes ( bcel created 'JavaClass' to describe the class).
    In order to determine if the classes are equal i create a 'DataClass' object with the following information:
    className
    Field [] fields (bcel 'Field' not java.lang.reflect.Field)
    Method [] methods (bcel 'Method' not java.lang.reflect.Method)
    I retrieve the information from JavaClass and put it in my 'DataClass'.
    This is the code I use to create a Vector for each framework ( Listing 1). This is where I store the data describing my classes in the api (Listing 2). Then I compare each 'DataClass' contained in the Vector.
    My intention is to compare the 'data' of the 'DataClass'. But since I get that all DataClass objects are NOT equal I guess I compare references. How can I do this.
    All hints are vey much welcome.
    cheers,
    //mikael
    Listing 1
    ==========
    Note: ClassSet is a 'Set' of JavaClass' objects.
    public static Vector makeDataObjects(ClassSet classes){
            Vector api = new Vector();
            JavaClass [] clazzes = classes.toArray();
            for (int i = 0; i < clazzes.length; i++) {
             JavaClass clazz = clazzes;
    DataClass dc = new DataClass();
    dc.setClassName(clazz.getClassName());
    Field [] fields = clazz.getFields();
    for(int j = 0; j < fields.length; j++){
    dc.setField(fields[j].toString());
    Method [] methods = clazz.getMethods();
    for (int k = 0; k < methods.length; k++) {
    dc.setMethod(methods[k].toString());
    api.add(dc);
    return api;
    Listing 2
    =========
    import java.util.ArrayList;
    public class DataClass implements Comparable{
        private String className = null;
        private ArrayList fields = new ArrayList();
        private ArrayList  methods = new ArrayList();
        public void setClassName(String className){
            this.className = className;
        public String getClassName(){
            return className;
        public void setField(String field){
            fields.add(field);
        public void setMethod(String method){
            methods.add(method);
        public int compareTo(Object o){
    }This is where I compare the content of my two api:s
    Listing 3
    =========
    public static void compare(Vector api1, Vector api2) {
    for (Iterator iter = api1.iterator(); iter.hasNext();) {
       DataClass clazz1 = (DataClass) iter.next();
       String className = (String) clazz1.getClassName();
       DataClass clazz2 = (DataClass) toBeCompared(className, api2);
       // compare object values
       System.out.println("clazz1 is " + clazz1.toString());
       System.out.println("clazz2 is " + clazz2.toString());
       if (clazz1.equals(clazz2)) {
        System.out.println("Objects are the SAME" + className);
       } else {
        System.out.println("Objects are NOT the same" + className);
    private static DataClass toBeCompared(String className, Vector api){
      DataClass dao = null;
      for (Iterator iter = api.iterator(); iter.hasNext();) {
        DataClass element = (DataClass) iter.next();
        String otherClassName = element.getClassName();
        if (className.equals(otherClassName)){
        dao = element;
    return dao;

    Your error is that you implement Comparable and the compareTo method instead of the equals method of Object class. Comparable is needed for ordering items. Equals instead is used to check if two objects are equal. Per convinience it is expected that there is no inconsistency if both equals and compateTo are implemented.
    So you should implement a method in DataClass:
    public boolean equals(Obejct o) {
      boolean result = false;
      if (o instanceof DataClass) {
        DataClass c = (DataClass) o;
        result = className.equals(c.className) &&
             fields.equals(c.fields) &&
             methods.equals(c.methods);
        // keep in mind here, that the arrays fields and
        // methods should be sorted / ordered. use Collections.sort(fields)
        // for this when you create or modify it
      return result;
    }You could also simplify the compare(Vector api1, Vector api2) method when you keep these Vectors sorted for className or use Set (what i dont recommand because of properbly performance drawbacks):
    public static void compare(Vector api1, Vector api2) {
      Collections.sort(api1, new ClassNameComparator());
      Collections.sort(api2, new ClassNameComparator());
      // you should possibly dont do this sorting here because the
      // method name does not state that the vectors are modified
      // but it's a precondition for make the following work properly:
      return api1.equals(api2);
    }i did not compile the code, so i hope i did not make many errors.
    regards
    Sven

  • Question: equals() for objects, not necessarily strings

    My book goes over the equals(String str) method, but it does not cover other objects. For example, in the code below the equals method returns false by printing, "The objects are not equal" even though both objects contain the same numbers. I looked at the API, but it was confusing. I'm not that far along yet. Any answers to why the equals() returns a false below?
    public class Exp
         public static void main(String[] args)
              Exp2 e = new Exp2(6, 8);
              Exp2 e1 = new Exp2(6, 8);
              if(e.equals(e1))
                   System.out.println("Objects are equal.");
              else
                   System.out.println("Objects are not equal.");
                   System.out.println("");
    }

    paulcw wrote:
    If you're the author of the Exp2 class, and you think that two objects of Exp2 that have been initialized with equal values should be equal (seems reasonable), then you'd define an equals method in Exp2 to express that.Exactly, just like the String class has code to explicitly compare the two String objects' characters.
    The default equals() doesn't automagically compare objects' contents. I just uses == to see if the two references are pointing to the same object. If you want other behavior, you have to provide it, like String does.

  • COmparing object using console...

    Hi ,
    I want to compare the objects in between the two db schemas. I am using Oracle enterprise console. Here when i am click the compare objects for the tables, i got the below error.
    Cannot perform operation for product"Oracle Change Manager" because another operation is already in progress for the product,or a previous ooperation on the product failed..
    I am getting the above errr. I need to compare the objects now. So how can remove the old operation on the product failes ,
    I am fist time using this console in comparing schems.
    My oracle client is 10.2 cleint ..
    please help me out in comparing the objects ...

    hi:
    Whether did you understand your stub that input by IDL compiler?
    Because the stub extends the org.omg.CORBA.portable.ObjectImpl and provide method _orb() to get current local ORB reference. you do so and repeat your steps in your text.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Moving object instead references

    I want to copy an object into a matrix, and then equal that object to zero. But it something goes wrong, I suspect this is because only a reference is copied into the matrix, and not the object itself. And when I remove the object, the reference is obsolete. Is there a way to avoid this? I tried implenting the Cloneable interface in the object, and then putting a clone in the matrix, but it still doesn't work. Thanks

    Your conception seems like C program. Be careful to do Object programmation.
    In Java, remember that you have only references (equivalent to pointers in C).
    In java you manipulate only the references through the variables.
    An object is never set to null, only the variables which contains references to this object. The object is still here but not reachable.
    Look this code :
    MyObject var1 = new MyObject();
    MyObject var2 = var1;
    var1 = null;
    Now let see how the program works :
    new MyObject() create an instance of the class MyObject and store it at the adress 2000 (for example).
    MyObject var1 = new MyObject();
    In the created variable var1, the adress of the newly created object will be stored. var1 <-- 2000
    MyObject var2 = var1;
    We create a new variable var2 in which we store the value of the variable var1 i.e. : 2000 : var2 <-- 2000
    var1 = null;
    In the variable var1 the value is set to null : var1 <-- null.
    At this moment the variable var1 contains no reference (null) and var2 still contains 2000 the adress of the object in memory.
    I hope it is clearer for you,
    Denis

  • Passing objects by reference in PL/SQL

    Hi,
    I have come across an unexpected problem using object types in PL/SQL that is causing me some grief. I'm from a Java background and am relatively new to Oracle Objects but what I'm trying to do is fairly trivial, I think. The code below illustrates the problem.
    --- cut here ---
    CREATE OR REPLACE TYPE test_obj_t AS OBJECT
    num INTEGER,
    CONSTRUCTOR FUNCTION test_obj_t RETURN SELF AS RESULT
    CREATE OR REPLACE TYPE BODY test_obj_t IS
    CONSTRUCTOR FUNCTION test_obj_t RETURN SELF AS RESULT IS
    BEGIN
    num := 0;
    RETURN;
    END;
    END;
    CREATE OR REPLACE PACKAGE test_obj_ref AS
    PROCEDURE init(o IN test_obj_t);
    PROCEDURE inc;
    FUNCTION get_num RETURN INTEGER;
    END;
    CREATE OR REPLACE PACKAGE BODY test_obj_ref IS
    obj test_obj_t;
    PROCEDURE init(o IN test_obj_t) IS
    BEGIN
    obj := o;
    END;
    PROCEDURE inc IS
    BEGIN
    obj.num := obj.num + 1;
    END;
    FUNCTION get_num RETURN INTEGER IS
    BEGIN
    RETURN obj.num;
    END;
    END;
    --- cut here ---
    The object type test_obj_t holds a integer and the test_obj_ref package holds a 'reference' to an instance of the object.
    To test the above code I run this PL/SQL block:
    declare
    obj test_obj_t;
    begin
    obj := test_obj_t;
    test_obj_ref.init(obj);
    dbms_output.put_line('obj.num='||obj.num);
    dbms_output.put_line('test_obj_ref.get_num='||test_obj_ref.get_num);
    test_obj_ref.inc;
    dbms_output.put_line('obj.num='||obj.num);
    dbms_output.put_line('test_obj_ref.get_num='||test_obj_ref.get_num);
    test_obj_ref.inc;
    dbms_output.put_line('obj.num='||obj.num);
    dbms_output.put_line('test_obj_ref.get_num='||test_obj_ref.get_num);
    end;
    giving the output:
    obj.num=0
    test_obj_ref.get_num=0
    obj.num=0
    test_obj_ref.get_num=1
    obj.num=0
    test_obj_ref.get_num=2
    It appears that the object held by the test_obj_ref package is being incremented as expected, but I would have expected the object declared in the PL/SQL block to be pointing to the same object and so should report the same incremented values.
    I suspect that the object is copied in the call to test_obj_ref.init() so I end up with two object instances, one that is held by the test_obj_ref package and one in the anonymous block. Although, I thought that all IN parameters in PL/SQL are passed by reference and not copied!
    Am I right?
    Is passing objects by reference possible in PL/SQL, if so how?
    I'm using Oracle 10.2.0.3.
    Cheers,
    Andy.

    the object being passed to the test_obj_ref.init+ procedure is passed by reference; however, when you assign it to your package variable obj it is being copied to a new instance. you can pass object instances as parameters to procedures using the +IN OUT [NOCOPY]+ *calling mode, in which case modifications to the attributes of the passed object will be reflected in the calling scope's instance variable.
    oracle's only other notion of an object reference is the +"REF &lt;object-type&gt;"+ datatype, which holds a reference to an object instance stored in an object table or constructed by an object view.
    hope this helps...
    gerard

  • I can't seem to get individual elements when comparing 2 arrays using Compare-Object

    My backup software keeps track of servers with issues using a 30 day rolling log, which it emails to me once a week in CSV format. What I want to do is create a master list of servers, then compare that master list against the new weekly lists to identify
    servers that are not in the master list, and vice versa. That way I know what servers are new problem and which ones are pre-existing and which ones dropped off the master list. At the bottom is the entire code for the project. I know it's a bit much
    but I want to provide all the information, hopefully making it easier for you to help me :)
    Right now the part I am working on is in the Compare-NewAgainstMaster function, beginning on line 93. After putting one more (fake) server in the master file, the output I get looks like this
    Total entries (arrMasterServers): 245
    Total entries (arrNewServers): 244
    Comparing new against master
    There are 1 differences.
    InputObject SideIndicator
    @{Agent= Virtual Server in vCenterServer; Backupse... <=
    What I am trying to get is just the name of the server, which should be $arrDifferent[0] or possibly $arrDifferent.Client. Once I have the name(s) of the servers that are different, then I can do stuff with that. So either I am not accessing the array
    right, building the array right, or using Compare-Object correctly.
    Thank you!
    Sample opening lines from the report
    " CommCells > myComCellServer (Reports) >"
    " myComCellServer -"
    " 30 day SLA"
    CommCell Details
    " Client"," Agent"," Instance"," Backupset"," Subclient"," Reason"," Last Job Id"," Last Job End"," Last Job Status"
    " myServerA"," vCenterServer"," VMware"," defaultBackupSet"," default"," No Job within SLA Period"," 496223"," Nov 17, 2014"," Killed"
    " myServerB"," Oracle Database"," myDataBase"," default"," default"," No Job within SLA Period"," 0"," N/A"," N/A"
    Entire script
    # things to add
    # what date was server entered in list
    # how many days has server been on list
    # add temp.status = pre-existing, new, removed from list
    # copy sla_master before making changes. Copy to archive folder, automate rolling 90 days?
    ## 20150114 Created script ##
    #declare global variables
    $global:arrNewServers = @()
    $global:arrMasterServers = @()
    $global:countNewServers = 1
    function Get-NewServers
    Param($path)
    Write-Host "Since we're skipping the 1st 6 lines, create test to check for opening lines of report from CommVault."
    write-host "If not original report, break out of script"
    Write-Host ""
    #skip 5 to include headers, 6 for no headers
    (Get-Content -path $path | Select-Object -Skip 6) | Set-Content $path
    $sourceNewServers = get-content -path $path
    $global:countNewServers = 1
    foreach ($line in $sourceNewServers)
    #declare array to hold object temporarily
    $temp = @{}
    $tempLine = $line.Split(",")
    #get and assign values
    $temp.Client = $tempLine[0].Substring(2, $tempLine[0].Length-3)
    $temp.Agent = $tempLine[1].Substring(2, $tempLine[1].Length-3)
    $temp.Backupset = $tempLine[3].Substring(2, $tempLine[3].Length-3)
    $temp.Reason = $tempLine[5].Substring(2, $tempLine[5].Length-3)
    #write temp object to array
    $global:arrNewServers += New-Object -TypeName psobject -Property $temp
    #increment counter
    $global:countNewServers ++
    Write-Host ""
    $exportYN = Read-Host "Do you want to export new servers to new master list?"
    $exportYN = $exportYN.ToUpper()
    if ($exportYN -eq "Y")
    $exportPath = Read-Host "Enter full path to export to"
    Write-Host "Exporting to $($exportPath)"
    foreach ($server in $arrNewServers)
    $newtext = $Server.Client + ", " + $Server.Agent + ", " + $Server.Backupset + ", " + $Server.Reason
    Add-Content -Path $exportPath -Value $newtext
    function Get-MasterServers
    Param($path)
    $sourceMaster = get-content -path $path
    $global:countMasterServers = 1
    foreach ($line in $sourceMaster)
    #declare array to hold object temporarily
    $temp = @{}
    $tempLine = $line.Split(",")
    #get and assign values
    $temp.Client = $tempLine[0]
    $temp.Agent = $tempLine[1]
    $temp.Backupset = $tempLine[2]
    $temp.Reason = $tempLine[3]
    #write temp object to array
    $global:arrMasterServers += New-Object -TypeName psobject -Property $temp
    #increment counter
    $global:countMasterServers ++
    function Compare-NewAgainstMaster
    Write-Host "Total entries (arrMasterServers): $($countMasterServers)"
    Write-Host "Total entries (arrNewServers): $($countNewServers)"
    Write-Host "Comparing new against master"
    #Compare-Object $arrMasterServers $arrNewServers
    $arrDifferent = @(Compare-Object $arrMasterServers $arrNewServers)
    Write-Host "There are $($arrDifferent.Count) differences."
    foreach ($item in $arrDifferent)
    $item
    ## BEGIN CODE ##
    cls
    $getMasterServersYN = Read-Host "Do you want to get master servers?"
    $getMasterServersYN = $getMasterServersYN.ToUpper()
    if ($getMasterServersYN -eq "Y")
    $filePathMaster = Read-Host "Enter full path and file name to master server list"
    $temp = Test-Path $filePathMaster
    if ($temp -eq $false)
    Read-Host "File not found ($($filePathMaster)), press any key to exit script"
    exit
    Get-MasterServers -path $filePathMaster
    $getNewServersYN = Read-Host "Do you want to get new servers?"
    $getNewServersYN = $getNewServersYN.ToUpper()
    if ($getNewServersYN -eq "Y")
    $filePathNewServers = Read-Host "Enter full path and file name to new server list"
    $temp = Test-Path $filePathNewServers
    if ($temp -eq $false)
    Read-Host "File not found ($($filePath)), press any key to exit script"
    exit
    Get-NewServers -path $filePathNewServers
    #$global:arrNewServers | format-table client, agent, backupset, reason -AutoSize
    #Write-Host ""
    #Write-Host "Total entries (arrNewServers): $($countNewServers)"
    #Write-Host ""
    #$global:arrMasterServers | format-table client, agent, backupset, reason -AutoSize
    #Write-Host ""
    #Write-Host "Total entries (arrMasterServers): $($countMasterServers)"
    #Write-Host ""
    Compare-NewAgainstMaster

    do not do this:
    $arrDifferent = @(Compare-Object $arrMasterServers $arrNewServers)
    Try this:
    $arrDifferent = Compare-Object $arrMasterServers $arrNewServers -PassThru
    ¯\_(ツ)_/¯
    This is what made the difference. I guess you don't have to declare arrDifferent as an array, it is automatically created as an array when Compare-Object runs and fills it with the results of the compare operation. I'll look at that "pass thru" option
    in a little more detail. Thank you very much!
    Yes - this is the way PowerShell works.  You do not need to write so much code once you understand what PS can and is doing.
    ¯\_(ツ)_/¯

  • Does Java pass objects by Reference

    The following is my code:
    public static boolean isValid(String tester, Integer intHours, Integer intMinutes)
              int dotPosition = tester.indexOf('.');
              String hours = tester.substring(0, dotPosition);
              String minutes = tester.substring(dotPosition +1, tester.length());
              try {
                        intHours = Integer.valueOf(hours);
                        intMinutes = Integer.valueOf(minutes);
         } catch (NumberFormatException nfe) {
         return false;
         return true;
    What Iam trying to do is pass the Integer Objects by reference so that they retain their values outside of the scope of the function. My teacher told me that objects are passed by reference in Java but (even though the values are being changed within the function they are not retaining their values outside the scope of the function. Was my teacher wrong?

    aden_jones wrote:
    So to get behaviour similar to passing by reference I would need to create my own object and give it a method e.g. MyObject.changeValue(new_value) but I can't do that with Integer objects because I can't change their actual value I can only change the Integer Object that is being pointed at??You cannot achieve behavior that duplicates PBR with Java.
    However, if by "similar to passing by reference" you mean that the method makes a change that the caller can see, then, yes, you need to pass a reference to a mutable object, and change that object's state inside the method.
    void foo(Bar bar) {
      bar.setBaz(123);
    Bar bar = new Bar();
    bar.setBaz(999);
    foo(bar);
    // after foo() completes, the caller now sees that the Bar object's internal state has changed
    // from 999 to 123Note the difference between changing the value of a caller's variable (which can be done with PBR, and cannot be done in Java) and changing the state of the single object pointed to by both the caller's variable and the method's copy of that variable (which can be accomplished in Java, as it does not rely on PBR).

  • Convert String Object to Comparable Object

    Getting all types of warnings in Eclipse when I try to cast. I have a method that wants to accept a Comparable<Object> and I would like to pass in a string, float, or integer, and make sure of the Comparable interface.

    EJP wrote:
    Try Comparable<?>. If that doesn't work please post some code.I will continue this thread then.
    inserInSubTree() is to take an attribute and compare it to another using Comparable.
    Here is my code:
    private PrimaryIndexNode insertInSubtree(Comparable<?> newAttribute,
                                            int newByteIndex, PrimaryIndexNode subTreeRoot)
              if (subTreeRoot == null)
                   return new PrimaryIndexNode(newAttribute, newByteIndex, null, null);
              else if(newAttribute.compareTo(subTreeRoot.attribute) < 0)
                   subTreeRoot.leftLink = insertInSubtree(newAttribute,
                                                      newByteIndex, subTreeRoot.leftLink);
                   return subTreeRoot;
              else
                   subTreeRoot.rightLink = insertInSubtree(newAttribute,
                                                      newByteIndex, subTreeRoot.rightLink);
                   return subTreeRoot;
         }I am unfamiliar with generics or the proper use of Comparable. what I desire to do is compare any object for ordering it and subsequently inserting it into a binary tree. I figured Comparable could do this and with auto up and down boxing I can do this for primitives and objects.
    However, unfamiliarity with what I need to do and having no clear example in my resources has left me without remedy.

  • Someone please help creating comparable objects

    I have been given a second part to an assignement that wants me to create a program for comparing student obejects. The assignment description and code are below. I can' t see how the find to method interlocks with the findsmallest because find smallest is already finding the smallest value. I also don't see where the new diffinitions for UMUC_Comparable goes.
    In the second part of this project, you will also find the smallest element in the array, but now the array will be of UMUC_Comparable objects. It will use the compareTo method to compare objects to find the smallest one. This method will also have the name findSmallest, but will take an array of UMUC_Comparable objects. This findSmallest method will have a definition as follows:
    UMUC_Comparable findSmallest(UMUC_Comparable[] array);
    The findSmallest method will use the compareTo method in the UMUC_Comparable interface. You will be using it with the Student objects from module V, section III, so you do not have to rewrite the compareTo method; you can simply use the one defined in the Student object in module V.
    For the second part of this project, you should:
    Create a main that creates an array of Student objects, as in section III of module V. You can use the same array as defined module V. You do not have to read these objects in from a file.
    Call the findSmallest method to find the smallest Student object.
    Use the getName and getAverage methods in the Student object to print out the smallest object.
    Note that the return from the method is a UMUC_Comparable object, not a Student object, so you must cast the returned object to a Student object before printing it out. You can do so as follows:
    Student[] students ....; // Fill in the declaration // of the student array.
    Student s = (Student)findSmallest(UMUC_Comparable[] array);
    /* File: Student.java
    * Author: Darrell Clark
    * Date: December 3, 2006
    * Purpose: Shows how to find the smallest Int value in an array
    import java.util.*;
    import java.io.*;
    public class Student {
    private int average;
    private String name;
    /* public constructor. Note that because no default
    * constructor exists, Student objects will always
    * be constructed with a name and an average.
    public Student(String name, int average) {
    this.average = average;
    this.name = name;
    } // end method
    * return name
    public String getName() {
    return name;
    } // end method
    * return average
    public int getAverage() {
    return average;
    } // end method
    * compare to method for locating smallest value
         public static int findSmallest(int[] array) {
              int min = Integer.MAX_VALUE;
              for (int i = 1; i < (array.length); i++) {
                   if (array[i] < min)
                        min = array;
              return min;
    * compare student value
    public int compareTo(Student student) {
    return (this.average - student.average);
    } // end method
         public static void main(String[] args) {
    Student[] studentArray = { new Student("Tom", 87),
    new Student("Cindy", 100),
    new Student("Pat", 75),
    new Student("Anne", 92),
    new Student("Matt", 82)};
    for (int i = 0; i < studentArray.length; i++) {
    System.out.println(studentArray[i].name + " " +
    studentArray[i].average);
    } // end for
    } // end method
    } // end class

    Were you given the UMUC_Comparable interface, or do you have to write it?
    (1) In the latter case, that is where to start. It includes the method
    compareTo(UMUC_Comparable). This will almost certainly return an
    int - check out the API documentatuon for the Comparable interface.
    (2) What I think the assignment is asking you to do is rewrite the Student
    class so that it implements UMUC_Comparable.
    Then you write the findSmallest(UMUC_Comparable[]) method. There is
    already a static method like this in the (existing) Student class. It's anybody's
    guess where this method is supposed to go - perhaps you could ask
    whoever gave you the assignment. The problem is that it can't go in
    UMUC_Comparable because that's an interface. And it doesn't really belong
    in Student because it is a sort of utility function that deals with any
    UNUC_Comparable array.
    (3) Let's assume that findSmallest(UMUC_Comparable[]) goes in the
    Student class. So you replace the existing findSmallest() with the new one.
    The new one goes through the array using the UMUC_Comparable's
    compareTo() method to find the smallest UMUC_Comparable.
    (4) Finally in main() you create a test array, use the newly rewritten
    findSmallest() to find the smallest Student, and print their name and
    average.

  • ORA-22806 : not an object or reference in 10gRel2

    Hi,
    We have recently successfully upgraded our oracle 8i database to 10.2.0.1
    database is up and running fine, but
    one of the user created procedure is giving error as below :
    ORA-22806 : not an object or reference
    See the below code :
    =============
    v_cnt:=0;
    Check_Str := 'SELECT COUNT(*) FROM P_EMP_HOLIDAY_DATE
    WHERE company_id=:p_Comp_id
    AND branch_id = :rec_branch.branch_id
    AND employee_id =:rec_emp.employee_id
    AND :v_nxt_date IN holiday_date';
    EXECUTE IMMEDIATE Check_Str INTO v_cnt USING p_Comp_id,rec_emp.branch_id, rec_emp.employee_id,v_nxt_date;
    Put_Any_Line('v_cnt : ' || v_cnt);
    when we run the procedure it gives the error at line 186 .i.e the line with EXECUTE IMMEDIATE statement in above
    so where is the problem ?
    this procedure was running fine without any problem in our oracle 8.1.7.0 version now showing error in 10.2.0.1
    is there any syntax problem that is not being suported in the upgraded version i.e. 10.2.0.1
    how to get it solved ?
    As this is very urgent to solve so any immediate support would be appreciated.
    with regards

    What is Put_Any_Line ? Why are you using dynamic sql here ?
    As this is very urgent to solve so any immediate support would be appreciated.Ok, then please, do not hesitate to use the Oracle support, and see how it can be immediate support.
    Nicolas.

  • Service Object Init References

    Has anyone come up with a good work around to allow Service Objects to
    reference other service objects in their init methods or during application
    startup. Since we can't specify the order in which Service Objects start,
    is there a way we can execute some code once all Service Objects have come
    online?
    Will this idea work?
    Start a task in the init method that loops for the referenced service object
    to not be nil, then references the needed SO. For example:
    while true do
    if LogMgrSO = Nil then
    task.delay(100);
    else
    exit;
    end if;
    end while;
    Eric Rasmussen
    Project Manager
    Online Resources & Communications Corporation
    (703)394-5128
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Hi,
    Sorry to answer so late ! I left (one year ago may be) some Tool code on
    the Mailing list on that subject.
    May be you have to consider some different cases :
    1&deg;) Is a Service started because it is only instanciated (<> NIL)?
    2&deg;) Forte insures that the first services to be started on a partition
    are DBsession and DBResource Managers.
    3&deg;) A local Service or a distributed service are not exactly treated the
    same way.
    4&deg;) The init() method has a specific way to run : the allocations are
    made at the end.
    1&deg;) When a Service is not NIL it is only that it is instanciated. So
    your initialization sequence is not endded may be or
    the service is not insured to be started properly. It should be
    important if you need to load a cache for instance. I
    would recommand to test that a service is ON (for DBsessions for
    instance) and to add (if possible) a state to determine
    that a service is properly started.
    2&deg;) This is only available if you are inside the same partition on the
    same machine. So if you have to synchronize with
    external ressources from the partition you will need to treat them like
    other services.
    3&deg;) A local Service will be NIL and then instanciated. The classname
    will be the same as in the workshop.
    A distrubuted service (exactly a service which is not on the same
    partition) will have a different classname (Classname+Proxy).
    So the external service proxy may be instanciated but the So May not,
    and you will get a DistributedAccessException.
    4&deg;) The init() method may not be the best location for a synchronization
    if you need to use an array for instance to
    store you dependencies. So I would use a start task on an InitService()
    method to avoid that problem.
    Options :
    - A dependency could be optionnal : after a certain amount of tries you
    can abort synchronization on the service.
    - You can use synchronization on "cold" and "hot" startup of services.
    - You can develop a service agent which cold have instruments to see
    dependencies and states, and commands to stop/start services.
    - The Delay you may play should be different for each service you are
    waiting for.
    - The order of dependencies should have an importance (first put
    mandatory dependancies, and then optional ones).
    - A Service is not only a Service Object, but could also be just a
    reference to an instance through a container for example.
    - Some kind of autoStart : should I start all my services at the
    beginning of my application or could I start some services
    at the first call ? This should be available if you use your own
    application protocole and if your services are inside some
    service managers for instance.
    Remarks :
    Thoses concepts have been tested on a Framework from R2 to R3 of Forte
    with success. With those, you can imagine
    starting the application without knowing if the database is running, the
    application will wait for the database
    to be mounted. An other advantage of the synchronization is that you
    will resolve the naming of the services at
    the begining of the application. Then, you can stop the environment
    manager and the application will still work
    (for the clients which were already started of course). You can also
    imagine transfering your partitions from one
    node to an other at run-time.
    Hope this helps,
    Daniel Nguyen
    Freelance Forte Consultant
    Stephen McHenry wrote:
    >
    At 11:04 AM 10/1/98 -0700, John Jamison wrote:
    begin
    while true do
    begin
    ..attempt "remote" SO reference..
    exit; // while true do loop
    exception
    when e:UsageException do // if in same partition and not yet
    initialized,
    // you get a NIL object exception
    task.errormgr.clear;
    when e:DistributedAccessException do (or RemoteAccessException)
    // if in a different partition, get this
    error
    task.errormgr.clear;
    end;
    event loop
    aTimer : Timer = new (tickInterval=5*1000); // 5 seconds -
    adjust to taste
    aTimer.isActive=true;
    when aTimer.Tick do
    aTimer.IsActive=false;
    exit;
    end event;
    end while;
    end;One of the problems I see with all of these "catch the exception and try
    again" schemes is that they fail to take into account that the SO you are
    calling may, in fact, never appear (due to some sort of problem, of course)
    and then you never exit this loop. It's a "liveness" problem with this
    approach. So, be sure to add some alternate way out after 1 minute (or
    whatever your particular threshold is) and raise an exception yourself.
    Always gotta think about what happens if something goes wrong... ;-)
    Stephen
    |===========================================================================
    ===|
    |Stephen McHenry | Design Consulting |Training courses
    offered: |
    |Advanced Software Tech | | -Distributed
    Obj-Oriented |
    |305 Vineyard Town Ctr #251| [email protected] | Analysis &
    Design |
    |Morgan Hill, CA 95037 | (408) 776-2720 x210 | -Intro to Object
    Technology|
    |USA | http://www.softi.com | -Advanced OO Design
    |
    |===========================================================================
    ===|
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Comparing objects from system other  system

    Hi,
    I need to compare the multiprovider from development system to production system.Is there is any program  avilable to compare objects. Please share.
    Thanks,
    vikk

    Hi Vikk,
    The important thing for multiprovider is characteristics and key figures identification.
    Use table RSDICMULTIIOBJ for getting the complete list of infoobjects having identification in multiprovider. Now you can either download the complete mapping in two excel sheet and then do the comparison using some vlookup technique.
    Or You can simply do the online comparison over development and production system.
    Regards,
    Durgesh.

  • Application Object Library Reference Manual in EBS 11.5.9 Docs

    Hi,
    I have bumped to a reference of the book "Application Object Library Reference Manual". Since this reference is about an old EBS version(10.6) and i want the equivalent of this for the EBS 11.5.9. , can you please write which one is this from url:
    http://download.oracle.com/docs/cd/B12190_11/current/html/docset.html
    Many thanks,
    Sim

    Hi,
    Actually , i have read on some docs located at :
    http://www.bryanthompsononline.com/oracle/2008/05/06/download-oracle-aim-applications-implementation-methodology-software/
    about the above reffered Oracle EBS document. I have searched on the typical Oracle EBS 11.5.9. doc , but i've not found this exactly doc (with this title). So , i have asked if anybody could point me to the relative doc on EBS 11.5.9. docs set......
    Many thanks for the link anyway.....
    Greetings,
    Sim

Maybe you are looking for

  • Regarding ReCreating Catalog in SQL Server 2005 which was existing in SQL Server 2000

    Hello I was using SQL SERVER 2000 ... In one table I've created FULL TEXT SEARCHING ( Full text catalog along with full text indexing) Now we had to install our db in SQL SERVER 2005 standard edition. But while taking script it gave me two lines like

  • Lion Stuck at login screen,can't type password

    My OSX Lion stuck at login screen,when I type password it just "beep" and I can only type few words.I just had those problem before..But since the battery ran out,and I gonna login...then I can't type the password...please help me.... P.S. My keyboar

  • Re-using variants in process chains

    Hi experts, Need some clarification on variants used in process chains. I have variants created as they are needed when adding steps like activating an ods. However, I need to re-use this step (activating the ods) in another chain, however I cannot s

  • How to prevent shipping if order pricing (EDI1) is incomplete

    Dear Gurus, would like to prevent shipping of sales orders that are incomplete due to EDI1 (customer expected price). Is it possible to configure the system so that delivery docs will only be created if the sales order pricing is complete? Wishes, Ab

  • Issue: Using utility class instance

    Hi, I need to use OIM APIs. I am using Eclipse IDE and have made the settings accordingly. I am able to connect successfully and also able to get the instance of factory class. Also then I am able to fetch the instance of utility class, tcUserOperati