Posts

Showing posts from October, 2013
<!--    sum.html       Copyright 2013 Ajay Bhatia <ajay@dumb-box>       This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.       This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.       You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,    MA 02110-1301, USA.    ...
/*  * SumApplet.java  *  * Copyright 2013 Ajay Bhatia <ajay@dumb-box>  *  * This program is free software; you can redistribute it and/or modify  * it under the terms of the GNU General Public License as published by  * the Free Software Foundation; either version 2 of the License, or  * (at your option) any later version.  *  * This program is distributed in the hope that it will be useful,  * but WITHOUT ANY WARRANTY; without even the implied warranty of  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  * GNU General Public License for more details.  *  * You should have received a copy of the GNU General Public License  * along with this program; if not, write to the Free Software  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  * MA 02110-1301, USA.  *  *  */ import javax.swing.JApplet; import javax.swing.JLabel; import javax.swing.JButto...
Some important questions (Unit-Wise) https://anonfiles.com/file/64a1567c5237040cbf28c2aa244b7a00
// Reading serializable objects from file import java.io.File; import java.io.FileInputStream; import java.io.ObjectInputStream; public class StudentRead {     public static void main(String[] args) throws Exception {         ObjectInputStream in = new ObjectInputStream(new FileInputStream(new File("student.ser")));                Student student = (Student)in.readObject();         System.out.println(student.getName());                student = (Student)in.readObject();         System.out.println(student.getName());     } }
// Write Student objects to file import java.io.File; import java.io.FileOutputStream; import java.io.ObjectOutputStream; public class StudentWrite {     public static void main(String[] args) throws Exception {         ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(new File("student.ser")));            Student st1 = new Student();         st1.setRollNo(1102107L);         st1.setName("Abhishek Bhatia");         st1.setCourse("BCA");                Student st2 = new Student();         st2.setRollNo(1102108L);         st2.setName("Anushi Kumra");         st2.setCourse("BCA");                Student...
// Serializable Student Class import java.io.Serializable; public class Student implements Serializable {     private long rollNo;     private String name;     private String course;        public void setRollNo(long rollNo) {         this.rollNo = rollNo;     }        public long getRollNo() {         return rollNo;     }        public void setName(String name) {         this.name = name;     }        public String getName() {         return name;     }        public void setCourse(String course) {         this.course = course;     }        public String getCourse() { ...