File Handling in Java Insert, Update, Delete, Search, Sort and Display with collection in File CRUD
ฝัง
- เผยแพร่เมื่อ 13 ต.ค. 2024
- This video demonstrates how to read write collection with insert, update, delete, search, sort in file handling in java.
Reading writing searching sorting collection in file handling in java.
Menu Driven Program in Java with following option
1. INSERT
2. DISPLAY
3. SEARCH
4. DELETE
5. UPDATE
6. SORT BY EMPNO ON SCREEN
7. SORT BY EMPNO IN FILE
8. SORT BY ENAME ON SCREEN
9. SORT BY ENAME IN FILE
10. SORT BY SALARY DESC ON SCREEN
11. SORT BY SALARY ASC IN FILE
#Java #Coding #Programming #CodingFunda #DrParagShukla
For Learning More about Programming
Subscribe to My Channel: www.youtube.co...
I can not believe why this channel has only 4.46k subs. Within some time I believe it will be in millions of subscribers.
The quality of content provided is awesome 🤩🤩🤩.
Thanks a lot sir.
You are teaching such a difficult topic in such a wonderful way that I can not express how easy now I feel programming is.
Once again thanks a lot sir.🙏
You are really a great teacher.
Thank You So Much for your kind words 🙏🙏
Please share to needy
Share to people who want to learn programming
@@DrParagShukla Sure sir.
@@achiever27 Thank You
SIR please make a successive video on how to Email this todo list
Just amazing, I'm a spanish programmer student and I find your video class super for those who are learnin with files and objects like me. Thanks you for your time, I will share your video with my friends! Greetings ! :)
Glad that you liked it
My Pleasure
Very useful sir, crisp and clear explanation
Understood very clearly and very useful video while learning file handling
Thank You
What a video sir..helped me clear all the concepts regarding the iterator usage and printstream usage.. Keep up the good work sir..
My Pleasure
Thank You So Much for appreciation
@@DrParagShukla SIR please make a video on how to Email this todo list...
Sending this todo list via email
सर आपका एक्सप्लेन करने का तरीका बहुत बढ़िया है
धन्यवाद🙏
Thank u Sir For this videos Very Usefull to me
It is Helps to My Project
My Pleasure
Sir, your explanation is excellent. Thank a lot sir
My Pleasure
Thank you for this very useful video!
Hello Sir. Parag your teaching skills are amazing and its very easy to understand how to demonstrate to us the program and also, i appreciate the manual creating the program, thank for for this you deserve my subscribe and i wish you all the best i hope your channel will grow soon! .
Thank You So Much for your wonderful words 🙏
korek ka jan max
@@DrParagShukla sir I have to choose one of the subjects in next semester those are Advance Java and Android Applications in Java... What to choose sir? Also I do DSA in Java only...
And after Java for a proper Software Development Engineer what skills are required in both product and service based company?
Please sir answer it as soon as possible...
If you did the DSA in Java and if you know the core Java then I think Android App Development is good option to select.
This is very insightful video... Can I request something to add ? like putting stack algorithm on your search case then when searches reaches to 2 it will show 'STACK is FULL' something like that
Thank you for wonderful suggestion.
Will try to add the same
owesome Video sir, completed learnt everything
Glad that you learned from this video.
Please share to needy.
Awesome clarification done by u sir in one video all things get clear
Thank You So Much
thank you for this video, this video can help me for my college task😍😍
Glad that it helps
My Pleasure
your demonstration java IDE is pleasing. what is the name of IDE which you have used here sir. this IDE which I would like to use. please....
Sublime
can we do this whole thing without using collection ? Just using the file ?
your awesome sir!
thank you for sharing this video.❤🙏
god luck and more power!!!👍
Great content as well as useful and informative
Thank u!
Glad that it helps
Thank you so much for your kind consideration
Can we add inheritence in this as well and read multiple files?? For example:- This was for one company but how can we add data for other companies and store them using inheritence??
Thank you so much Shukla for given this awesome video..........:)
My Pleasure
Best Video seen so far regarding file handling
next Time pls explain theory too
Thank You
Sure
@@DrParagShukla provide source code too
Please find source code link
videosourcecode.blogspot.com/2021/10/file-handling-in-java-insert-update.html
@@DrParagShukla thank u so much keep supporting
@@akashdhakane7103 My Pleasure
that was really helpful sir
Thank you so much
Sir you deserve this 👑 ❤🔥
Thank You
Thank you! This helped me with my work!
Glad that it helps
My Pleasure
Thanq so much sir...🙏🙏
My Pleasure
Amazing tutorial
Thank You So Much
Sir where can you please post this whole code
Source Code Link
videosourcecode.blogspot.com/2021/10/file-handling-in-java-insert-update.html
hello sir I have to make java project on file handling and I have written it but getting some error can you pls help me resolve it...I have project evalution on this friday
Glad I found this video, keep it up sir
Thank You
Thankkkkyou very muchhh to make this video ☺️☺️☺️☺️
My Pleasure
What a amazing video❤️
Thank You
@@DrParagShukla Welcome Sir
Thanks a lot bro 😍😍😍😍 very useful video, you deserve better 💗
Glad that you liked it.
Thanks sir
My Pleasure
Great video Thanks
My Pleasure
To write this program which topics should I aware?
Collections and file handling is over?
Concept of Collection must be clear before this
Link for the same is th-cam.com/video/O-XrUJj83E0/w-d-xo.html
Really helpful video 👍
Thank You
Hello Dr. how can you add all the salaries only? Is that possible?
thank you so much sir
My Pleasure
Ur country is legend
Thank you so much))
love u sir ji
thanks bro, you helped me a lot!!
Glad to hear that!
very helpful, thank you so much!
My Pleasure
Why is the employee.txt file not displaying the correct value after insertion? when the txt is open.
Did you find a solution?
What java concepts have been used in this code?
Hello Sir,
What should I do if I want to use marks as float..
what are the changes should I do?
You can declare marks as a float
@@DrParagShukla I have another doubt too sir...is there any way to simplify this program....how can I study all this...can you share me any website link or material?
@@ajayv6964 you can follow playlist of Java for beginners. If you are fresher
@@DrParagShukla how to add test cases for this program using junit?
Can we perform 2 function in a same code. In this example we perform Employee name,id,salary. Can we perform Billing System which consists of Cashier name,id and product name,id,price in a Same manner. Plese help me sir ,i struggle with this problem.
Yes we can
Create 2 different class one for Employees and another for Product and do the same.
for the love of god, if you read my comments I just want to say THANK YOU SO MUCH
My Pleasure
super sir
Thank You
Hi sir, i've questions regarding this topic and how may i contact you ?
Hello sir
How to send data of CSV file to database.. please .. tell me sir.
Please Sir, I found An error in line 30,it says Exception in thread "main" java.io.EOFException.
I found this error too, can you explain how you solved this error
hello sir how can you connect this into database?
To connect this into JDBC watch following Video
th-cam.com/video/JiWw_kObYgs/w-d-xo.html
whats is the name of the app you are using ??
Editor Sublime
Hello how can I add a feature where employee ids cannot be duplicated?
How to delete the brackets when in tostring?
22:10 sir i still don't understand why you typecasted to Employee type, aren't li items already of Employee type?
the li is not a employee
Life saving!
Thank You
sir how to do this by only using static arrays ?
File handling on c program par bhi video banai
It is already posted please check
th-cam.com/video/1lNL31q4T5I/w-d-xo.html
SIR please make a successive video on how to Email this todo list
Sure
Sir how to create retrieve, please help me
28:17 delete
32:12 edit
Hello sir by using this video I write the same program it was executed successfully but now when I executing the same it generates exception I.e. can not cast to ArrayList....please solve my problem
Share your code here.
I will correct it.
@@DrParagShukla
package IOStreams.Project2;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
import java.io.*;
import java.util.ListIterator;
public class Emp implements java.io.Serializable
{
int id;
String name;
int age;
double salary;
Emp(int id, String name, int age, double salary)throws FileNotFoundException, IOException,ClassNotFoundException
{
this.id=id;
this.name=name;
this.age=age;
this.salary=salary;
}
public String toString()
{
return name +" "+id+" "+age +" "+ salary;
}
}
class EmployeeDemo
{
public static void main(String[] args) throws IOException,FileNotFoundException,ClassNotFoundException{
int ch;
Scanner sc=new Scanner(System.in);
Scanner sc1=new Scanner(System.in);
ArrayListal=new ArrayList();
File f=new File("C:\\Users\\Ganesh Krishnapakshi\\Documents\\NetBeansProjects\\SelfLearnWipro\\Data1.txt");
ObjectOutputStream op=null;
ObjectInputStream oi=null;
ListIterator li=null;
if(f.isFile())
{
oi=new ObjectInputStream(new FileInputStream(f));
al=(ArrayList)oi.readObject();
oi.close();
}
do
{
System.out.println("Main Menu");
System.out.println("1. Add an Employee");
System.out.println("2. Display All");
System.out.println("3. Exit");
System.out.println("Please enter Your Choice");
ch=sc.nextInt();
switch(ch)
{
case 1:System.out.println("Add an Employee");
System.out.println( "Enter number of Employee");
int n=sc1.nextInt();
for(int i=0;i
@@DrParagShukla Thanks sir for considering my problem
Hello sir I follow your step by step code. But the output looks like byte like [emp@2b5ldbs]
You need to override the toString() method
@@DrParagShukla how sir? I follow all of your code.
@@xueyouye8562 please post your code here
I will correct the same.
Here sir , I can't proceed cuz of that problem
Hello sir i fix it but..
Exception in thread "main" java.io.InvalidClassException: Student; local class incompatible: stream classdesc serialVersionUID = 3490343042921908535, local class serialVersionUID = -2774891864663342562
Sir i used your code and compiled it ,but after compiling its shows this kind of error.
Note Employee java uses unchecked or unsafe operations
Note Recompile with lint unchecked for details
Yes this warning came whenever you use any deprecated operation.
You may suppress Warning using annotations
sir how about if i will use the ename to search and delete pls help
Use .equals() function to match the String
where to insert sir? string ename = s1.nextLine(); or string ename = s1.equals(); ?
Try following
if(file.isFile()){
ois = new ObjectInputStream(new FileInputStream(file));
al = (ArrayList)ois.readObject();
ois.close();
boolean found = false;
System.out.println("Enter Name to Search : ");
String ename = s.nextLine();
System.out.println("-------------------------------------");
li = al.listIterator();
while(li.hasNext()){
Employee e = (Employee)li.next();
if(e.ename.equals(ename)){
System.out.println(e);
found = true;
}
}
if(!found)
System.out.println("Record Not Found...!");
System.out.println("-------------------------------------");
}else{
System.out.println("File not Exists....!");
}
Let me know if not work
Okay sir i will let you know
Hello sir, how can I save this file?
File will be created on path you have mentioned.
Please provide the code link of this video
Source Code available at following link
videosourcecode.blogspot.com/2021/10/file-handling-in-java-insert-update.html
Sir, may u help me to check my code as I cannot print the output in the search case and I dunno where is the error...😭
Yes Sure
Please write your code here
I will look into the same.
@@DrParagShukla Thank you sir, but I have find out the problem and solve it, now the code is functioning perfectly. Thanks a lot for this perfect video. Nice explanation and very easy to understand. Hope to see more videos in this channel. I hope you will get millions subscribe in the future, keep it up.
Thank you so much for your kind words
How about in c++
When I display data from file it loads up as null. How do I fix this?
Can you share your code?
I will correct it
Sir I have problem in searching
Where do i find the code
which IDE is using anyone?
do you have your code of this sir?
Following is the link of source code
videosourcecode.blogspot.com/2021/10/file-handling-in-java-insert-update.html
@@DrParagShukla thank you so much sir
@@DrParagShukla thank you so much sir
Sir can we get a copy of the code please?
Source code ia available at following link
videosourcecode.blogspot.com/2021/10/file-handling-in-java-insert-update.html
37:20
For sorting collection
u have source code for this?
can you provide source code ?
Following is the link of source code
videosourcecode.blogspot.com/2021/10/file-handling-in-java-insert-update.html
@Dr. Parag Shukla Thanks ,, Very useful video . your explanation is very good .
My Pleasure
sir share code please
Source Code available at following link
videosourcecode.blogspot.com/2021/10/file-handling-in-java-insert-update.html
source code
Following is the link of source code
videosourcecode.blogspot.com/2021/10/file-handling-in-java-insert-update.html
How to loop back to Enter Employee Number until I get a valid input?
case 1:
System.out.print("Please Enter How Many Employees You Want To Add:");
int n = s.nextInt();
for (int i = 0; i < n; i++) {
boolean found = false;
System.out.print("Enter Employee Number: ");
int empno = s.nextInt();
System.out.println("--------------------------------------------------");
li = al.listIterator();
while (li.hasNext()) {
Employee e = (Employee) li.next();
if (e.empno == empno) {
System.out.println("The Employee Number Already Exists");
System.out.println("--------------------------------------------------");
found = true;
}
Put another do while loop in case 1
@@DrParagShukla tried adding a do loop before the while loop but it keeps on saying that empno is not not declared
Very helpful video.. thank you so much sir.
Glad to hear that it helps
My Pleasure
Thank you sir, it really helped me a lot.
My Pleasure
Glad that it helps
@@DrParagShukla SIR please make a successive video on how to Email this todo list