Posts

File Handling in Java Insert, Update, Delete, Search, Sort and Display with collection in File

Image
//Source Code of Video File Handling in Java import java.util.*; import java.io.*; class Employee implements Serializable{ int empno; String ename; int salary; Employee( int empno, String ename, int salary){ this .empno = empno; this .ename = ename; this .salary = salary; } public String toString(){ return empno+ " " +ename+ " " +salary; } } class EmployeeDemo{ public static void main(String[] args) throws Exception{ int choice = - 1 ; Scanner s = new Scanner(System.in); Scanner s1 = new Scanner(System.in); File file = new File( "employee.txt" ); ArrayList<Employee> al = new ArrayList<Employee>(); ObjectOutputStream oos = null ; ObjectInputStream ois = null ; ListIterator li = null ; if (file.isFile()){ ois = new ObjectInputStream( new FileInputStream(file)); al = (ArrayList<Employee>)ois.readObject(); ois.close...

Source Code of Video File Handling in C - INSERT, UPDATE, DELETE, SORT, SEARCH of STUDENT RECORD - IN FILE WITH STRUCTURE

Video : File Handling in C (CRUD Operation) /*Source Code of Video File Handling in C - INSERT, UPDATE, DELETE, SORT, SEARCH of STUDENT RECORD - IN FILE WITH STRUCTURE */ #include <stdio.h> typedef struct student{ int rno; //Member of structure char name[ 20 ]; //Pointer within structure struct subject{ //Structure within Structure int scode; char name[ 20 ]; //Array within structure int mark; }sub[ 3 ]; //Array of Structure int total; float per; }student; void create(){ student *s; FILE *fp; int n,i,j; printf( "Enter how many students : " ); scanf( "%d" ,&n); s = (student*)calloc(n, sizeof (student)); fp = fopen( "mystudents1.txt" , "w+" ); for (i= 0 ;i<n;i++){ s[i].total= 0 ; s[i].per= 0 ; printf( "Enter RollNo : " ); scanf( "%d" ,&s[i].rno); ...

Source Code of Video Java Collection - CRUD Operation (INSERT, UPDATE, DELETE, SEARCH and DISPLAY of Employee Collection)

/*Source code of Video Java Collection - CRUD Operation INSERT, UPDATE, DELETE, SEARCH and DISPLAY of Employee Collection*/   import java.util.*; class Employee{ private int empno; private String ename; private int salary; Employee( int empno, String ename, int salary){ this .empno = empno; this .ename = ename; this .salary = salary; } public int getEmpno(){ return empno; } public int getSalary(){ return salary; } public String getEname(){ return ename; } public String toString(){ return empno+ " " +ename+ " " +salary; } } class CRUDDemo{ public static void main(String[] args) { List<Employee> c = new ArrayList<Employee>(); Scanner s = new Scanner(System.in); Scanner s1 = new Scanner(System.in); int ch; do { System.out.println( "1.INSERT" ); System.out.println( "2.DISPLAY" ); System.out.pri...