public String viewByItemCode(String icode)
    {
        String search = " ";
        
        for( ; x<recordNum ; x++)
        {
            if(itemRef[x].getItemCode() == icode)
            {
                search = ("\nItem Code: " +itemRef[x].getItemCode()+ "\nItem Description: " +itemRef[x].getItemDesc()+ "\nItem Unit Price: " 
                        +itemRef[x].getItemUnitPrice()+ "\nItem Quantity: " +itemRef[x].getItemQty()+ "\nItem Unit Measure: " 
                        +itemRef[x].getItemUnitMeasure()+"\n");     
            }       
        }
        return search;
    }

Supposed to return a record placed in a String so I can print it in main, but it doesn't work. :( Help?

what "doesn't work"?

For one you don't define "x" anywhere. If defined outside the method, VERY BAD.

what "doesn't work"?

For one you don't define "x" anywhere. If defined outside the method, VERY BAD.

Yes, I defined it outside the method. This is only my second JAVA program. I'm new to JAVA, I have been using C, but my subject in school requires JAVA. Thanks for taking a look. God bless!