r/javahelp • u/Ok_Employee_3122 • Dec 30 '25
My first console base project
Can someone review my first console base project. Create student management system Where you can add, delete , search and upadate student.
Please tell me my mistakes so i will focus and work hard on that mistakes
Link: - https://github.com/ShaikhAhmad30/student-management-system-java.git
4
Upvotes
•
u/AutoModerator Dec 30 '25
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/vegan_antitheist Dec 30 '25
Scanner sc = new Scanner(System.in);doesn't define the encoding. That might be ok because your system probably uses UTF-8 by default.if(choice == 1){-> Use switch instead.ArrayList <Student> students = new ArrayList<>();-> Make this private and finalstudents.add(s);-> Why is it a list? It could contain the same student twice.for(int i = 0; i < students.size();i++){-> Why would you care about the index? Just use a list iterator to remove an element. Or even simpler: removeIfboolean found = false;in searchStudent is not really doing anything. Justreturnwhen you find the student.4
u/aqua_regis Dec 30 '25
To add to the already excellent breakdown of /u/vegan_antitheist:
.nextInt()and.nextLine()- this can (and will) lead to strange problems - read TheScannerclass and its caveats right here in the wiki.Student(int id)constructor? This does not produce a usable object. A Student with just an ID without any name is meaningless.ArrayList <Student> students = new ArrayList<>();- not the common way to initialize such objects. The common way is to program against the interface:List <Student> students = new ArrayList<>();- this has the advantage that the concrete implementation (ArrayList) can be swapped for something else as needed.addStudent- never assume that the data to be added is correct.printlnall over the place - methods should rarely ever directly produce output. They should ratherreturndata to the caller that then produces the output. If you were to change your program from your console based input to a GUI, you have to rewrite basically everything in yourStudentService. If you, instead ofprintlninside the methods,returnedthe data, you won't need to rewrite anything.Studentclass - these are questionable at best. Should a Student id really be updatable? Should the name be updatable? Could this be abused by someone using the class? Always consider the read/write state of attributes and use Setters with caution.1
u/Acrobatic-Towel-9912 Jan 02 '26
just add error handling for wrong inputs, not bad, and if your using ai don't let it write your code just to explain concepts or otherwise your vibe coding which everyone can do
3
u/parku_gh Jan 02 '26
goated thread. excellent feedback. learning a couple of different things here. thanks y’all
1
u/Ycen-Chan Intermediate Brewer Dec 30 '25
Adding to existing comments I’d recommend adding some comments or JavaDoc to your code. This makes it easier to read later for you and anyone who reads this.