In Java...
For example I have a BankAccount class which stores a bankID and balance in an object array. I have to ask the user for a name and if it matches a value stored in the array print "Found" and if no matching ID is found print "Error".
So heres my code so far:
        
                
                
                    For example I have a BankAccount class which stores a bankID and balance in an object array. I have to ask the user for a name and if it matches a value stored in the array print "Found" and if no matching ID is found print "Error".
So heres my code so far:
Code:
        
    Problem is its not working...Scanner scan = new Scanner(System.in);
System.out.println("Enter the id:");
String id = scan.next();
scan.nextLine();
for (int i=0; i<count; i++)
    {
    String temp = accts.getID();
        if (id == temp)
           System.out.println("Found");
       else
           System.out.println("Error");
    }
 
