problem i have been trying to validate the subject code which is written on a file called Subjects.txt i want to validate if the subjectcode on the file is unique and does not contain the same subject code.
here is code of methods so far:
Code Java:public boolean codeExists () throws Exception{ File file = new File ("Subjects.txt"); Scanner input = new Scanner(file); boolean exists = false; while(input.hasNext()){ String subjectCode = input.next(); String subjectName = input.next(); if(input.next().equals(subjectCode)){ exists = true; } else{ exists = false; } } input.close(); return exists; }
thanks :)
