Java Class Object List (ArrayList)

Asked 2 years ago, Updated 2 years ago, 85 views

I'm trying to create a banking system. Using ArrayList and class systems, he made it possible for several people to open their accounts The error keeps coming up at the part where I check the card number. I don't think it's the right way. I didn't know what it was. I'd appreciate it if you let me know.

As I captured below, the error is notifications.

This is the code to check if the card number I wrote is saved in the system.

//loop is a while statement.
loop :while(true) {
                     //If the 'number' of the ArrayList object does not have a value...
                    The part between //** indicates the error.
                   ** ** if((list.get(i).number) == null) **{
                                 If there are no more objects stored in //list...
                                 if(list.size()) < i){
                                        Run a method (function) to output the error message //not working and leave the loop.
                                        notworking();
                    break loop;
                } //If you have the number of objects stored in the list...
                else{
                                Add 1 to //i and continue looping.
                i++;
                continue loop;
                }
            }//If the 'number' of the ArrayList object has a value...
            else {
                // output a method (function) that outputs related information and exits the loop.

                Showinfo(scan, i);
                                break loop;
            }

java class entity list classmember

2022-09-21 20:56

1 Answers

If you look at the error message carefully, the operator == is undefined for... There's a message called "long."

class CodeRunner{
    public static void main(String[] args){
        if(1==null){
            System.out.println("Hello Java");
        }
        }
}

It looks like the same error as you executed this code. Long and null are not comparable.


2022-09-21 20:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.