search by name in Array Staff is not show

2100 views java
4

        public String searchByName(String tenNV) {
            String[] informationStaff = information.split("\t");
            if(informationStaff[0].equals(tenNV)) {
                result = " Có nhân viên tên: " + tenNV;
            }else {
                result = " Không có nhân viên tên: " + tenNV;
            }
            return result;

        }
        public static void main(String[] args) {
            NhanVien staff = new NhanVien();
            staff.nhap();
            System.out.println("Nh?p tên nhân viên c?n tìm: ");
            String nameStaffNeedSearch = scanner.nextLine();
            String kQ = staff.searchByName(nameStaffNeedSearch);
            System.out.println(kQ);
        }

    }

i enter array(3) people + phone number. when i search name of people. it not run. error i don't know resolve.

answered question

What is the error? Where do you declare result in searchByName?

Does this even compile? information.split?? Where did you define information?

1 Answer

4

Kindly post more of your code, the error and what you expected.

posted this

Have an answer?

JD

Please login first before posting an answer.