-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
666822d
commit 78218af
Showing
45 changed files
with
534 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>EXPERIMENT1</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=17 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=17 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package EXPERIMENT1; | ||
|
||
import java.io.*; | ||
class Deserial { | ||
public static void main(String args[]){ | ||
try{ | ||
FileInputStream fin = new FileInputStream("d:\\f.txt"); | ||
ObjectInputStream in=new ObjectInputStream(fin); | ||
Student s1=(Student)in.readObject(); | ||
Student s2=(Student)in.readObject(); | ||
Student s3=(Student)in.readObject(); | ||
Student s4=(Student)in.readObject(); | ||
Student s5=(Student)in.readObject(); | ||
|
||
|
||
System.out.println(s1); | ||
System.out.println(s2); | ||
System.out.println(s3); | ||
System.out.println(s4); | ||
System.out.println(s5); | ||
in.close(); | ||
}catch(Exception e){ | ||
System.out.println(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package EXPERIMENT1; | ||
|
||
import java.io.*; | ||
class Serial{ | ||
public static void main(String args[]){ | ||
try | ||
{ | ||
Student s1 =new Student(1,"ram", 1000); | ||
Student s2 =new Student(2,"shyam", 2000); | ||
Student s3 =new Student(3,"mohan", 3000); | ||
Student s4 =new Student(4,"sohan", 4000); | ||
Student s5 =new Student(5,"mohan", 5000); | ||
FileOutputStream fout=new FileOutputStream("d:\\f.txt"); | ||
ObjectOutputStream out=new ObjectOutputStream(fout); | ||
out.writeObject(s1); | ||
out.writeObject(s2); | ||
out.writeObject(s3); | ||
out.writeObject(s4); | ||
out.writeObject(s5); | ||
out.flush(); | ||
out.close(); | ||
System.out.println("success"); | ||
} | ||
catch(Exception e){ | ||
System.out.println(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package EXPERIMENT1; | ||
|
||
import java.io.Serializable; | ||
|
||
public class Student implements Serializable { | ||
int rno; | ||
String name; | ||
float fees; | ||
public Student(int id1, String name1, float fees1) { | ||
this.rno = id1; | ||
this.name = name1; | ||
this.fees = fees1; | ||
} | ||
public String toString() { | ||
return rno + " " + name +" " + fees +"\n"; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* | ||
*/ | ||
module EXPERIMENT1 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>EXPERIMENT2</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=17 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=17 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package EXPERIMENT2; | ||
|
||
import java.io.*; | ||
import java.util.*; | ||
|
||
class Student { | ||
int rollno; | ||
String name; | ||
float fees; | ||
String branch; | ||
int year; | ||
int sem; | ||
int age; | ||
static String clg; | ||
float salary; | ||
|
||
public Student(int rollno,String name,float fees,String branch,int year,int sem,int age,float salary) { | ||
this.rollno = rollno; | ||
this.name = name; | ||
this.fees = fees; | ||
this.branch = branch; | ||
this.year = year; | ||
this.sem = sem; | ||
this.age = age; | ||
clg="PU"; | ||
this.salary=salary; | ||
} | ||
@Override | ||
public String toString() { | ||
return rollno + " "+ name + " " + fees + " " + branch + " " + year + sem + " " + age + " " + clg + " "+salary+"\n"; | ||
} | ||
} | ||
class AgeComparator implements Comparator { | ||
public int compare(Object o1, Object o2) { | ||
Student s1=(Student)o1; | ||
Student s2=(Student)o2; | ||
if(s1.age==s2.age) | ||
return 0; | ||
else if(s1.age>s2.age) | ||
return 1; | ||
else | ||
return -1; | ||
} | ||
} | ||
class SalaryComparator implements Comparator{ | ||
public int compare(Object o1, Object o2) { | ||
Student s1 = (Student) o1; | ||
Student s2 = (Student) o2; | ||
if (s1.salary == s2.salary) | ||
return 0; | ||
else if (s1.salary > s2.salary) | ||
return 1; | ||
else | ||
return -1; | ||
} | ||
} | ||
|
||
class NameComparator implements Comparator{ | ||
public int compare(Object o1, Object o2) { | ||
Student s1=(Student)o1; | ||
Student s2=(Student)o2; | ||
return s1.name.compareTo(s2.name); | ||
} | ||
} | ||
class FeesComparator implements Comparator { | ||
public int compare(Object o1,Object o2) { | ||
Student s1=(Student)o1; | ||
Student s2=(Student)o2; | ||
if(s1.fees==s2.fees) | ||
return 0; | ||
else if(s1.fees>s2.fees) | ||
return 1; | ||
else | ||
return -1; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package EXPERIMENT2; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.Iterator; | ||
|
||
public class TEMP1 { | ||
|
||
public static void main(String[] args) { | ||
// TODO Auto-generated method stub | ||
ArrayList sl=new ArrayList(); | ||
sl.add(new Student(1,"Shiva",10000.00f,"cse",1,1,18,20000.00f)); | ||
sl.add(new Student(2,"Venky",15000.00f,"ise",1,2,20,25000.00f)); | ||
sl.add(new Student(3,"Jesus",17000.00f,"ece",1,1,19,30000.00f)); | ||
sl.add(new Student(3,"Alla",12000.00f,"eee",1,1,19,30000.00f)); | ||
sl.add(new Student(3,"Budha",11000.00f,"mech",1,1,21,30000.00f)); | ||
System.out.println("Sorting by Name"); | ||
System.out.println("_______________"); | ||
Collections.sort(sl,new NameComparator()); | ||
Iterator itr=sl.iterator(); | ||
while(itr.hasNext()){ | ||
Student st=(Student)itr.next(); | ||
System.out.println(st); | ||
} | ||
System.out.println("Sorting by age"); | ||
System.out.println("______________"); | ||
Collections.sort(sl,new AgeComparator()); | ||
Iterator itr2=sl.iterator(); | ||
while(itr2.hasNext()) { | ||
Student st=(Student)itr2.next(); | ||
System.out.println(st ); | ||
} | ||
System.out.println("Sorting by fees"); | ||
System.out.println("______________"); | ||
Collections.sort(sl,new FeesComparator()); | ||
Iterator itr1=sl.iterator(); | ||
while(itr1.hasNext()){ | ||
Student st=(Student)itr1.next(); | ||
System.out.println(st); | ||
} | ||
System.out.println("Sorting by salary"); | ||
System.out.println("______________"); | ||
Collections.sort(sl,new SalaryComparator()); | ||
Iterator itr3=sl.iterator(); | ||
while (itr3.hasNext()) { | ||
Student st = (Student) itr3.next(); | ||
System.out.println(st); | ||
} | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* | ||
*/ | ||
module EXPERIMENT2 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="lib" path="C:/Users/Admin/Downloads/mysql-connector-j-8.3.0/mysql-connector-j-8.3.0/mysql-connector-j-8.3.0.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>EXPERIMENT3</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=17 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=17 |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.