Skip to content

Commit 78218af

Browse files
committed
exp update
1 parent 666822d commit 78218af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+534
-0
lines changed

EXPERIMENT1/.classpath

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src"/>
9+
<classpathentry kind="output" path="bin"/>
10+
</classpath>

EXPERIMENT1/.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>EXPERIMENT1</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=17
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13+
org.eclipse.jdt.core.compiler.release=enabled
14+
org.eclipse.jdt.core.compiler.source=17
1.19 KB
Binary file not shown.
1.35 KB
Binary file not shown.
1.05 KB
Binary file not shown.

EXPERIMENT1/bin/module-info.class

150 Bytes
Binary file not shown.
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package EXPERIMENT1;
2+
3+
import java.io.*;
4+
class Deserial {
5+
public static void main(String args[]){
6+
try{
7+
FileInputStream fin = new FileInputStream("d:\\f.txt");
8+
ObjectInputStream in=new ObjectInputStream(fin);
9+
Student s1=(Student)in.readObject();
10+
Student s2=(Student)in.readObject();
11+
Student s3=(Student)in.readObject();
12+
Student s4=(Student)in.readObject();
13+
Student s5=(Student)in.readObject();
14+
15+
16+
System.out.println(s1);
17+
System.out.println(s2);
18+
System.out.println(s3);
19+
System.out.println(s4);
20+
System.out.println(s5);
21+
in.close();
22+
}catch(Exception e){
23+
System.out.println(e);
24+
}
25+
}
26+
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package EXPERIMENT1;
2+
3+
import java.io.*;
4+
class Serial{
5+
public static void main(String args[]){
6+
try
7+
{
8+
Student s1 =new Student(1,"ram", 1000);
9+
Student s2 =new Student(2,"shyam", 2000);
10+
Student s3 =new Student(3,"mohan", 3000);
11+
Student s4 =new Student(4,"sohan", 4000);
12+
Student s5 =new Student(5,"mohan", 5000);
13+
FileOutputStream fout=new FileOutputStream("d:\\f.txt");
14+
ObjectOutputStream out=new ObjectOutputStream(fout);
15+
out.writeObject(s1);
16+
out.writeObject(s2);
17+
out.writeObject(s3);
18+
out.writeObject(s4);
19+
out.writeObject(s5);
20+
out.flush();
21+
out.close();
22+
System.out.println("success");
23+
}
24+
catch(Exception e){
25+
System.out.println(e);
26+
}
27+
}
28+
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package EXPERIMENT1;
2+
3+
import java.io.Serializable;
4+
5+
public class Student implements Serializable {
6+
int rno;
7+
String name;
8+
float fees;
9+
public Student(int id1, String name1, float fees1) {
10+
this.rno = id1;
11+
this.name = name1;
12+
this.fees = fees1;
13+
}
14+
public String toString() {
15+
return rno + " " + name +" " + fees +"\n";
16+
}
17+
}
18+

EXPERIMENT1/src/module-info.java

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
*
3+
*/
4+
/**
5+
*
6+
*/
7+
module EXPERIMENT1 {
8+
}

EXPERIMENT2/.classpath

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src"/>
9+
<classpathentry kind="output" path="bin"/>
10+
</classpath>

EXPERIMENT2/.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>EXPERIMENT2</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=17
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13+
org.eclipse.jdt.core.compiler.release=enabled
14+
org.eclipse.jdt.core.compiler.source=17
667 Bytes
Binary file not shown.
672 Bytes
Binary file not shown.
688 Bytes
Binary file not shown.
678 Bytes
Binary file not shown.
1.36 KB
Binary file not shown.
2.08 KB
Binary file not shown.

EXPERIMENT2/bin/module-info.class

150 Bytes
Binary file not shown.
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package EXPERIMENT2;
2+
3+
import java.io.*;
4+
import java.util.*;
5+
6+
class Student {
7+
int rollno;
8+
String name;
9+
float fees;
10+
String branch;
11+
int year;
12+
int sem;
13+
int age;
14+
static String clg;
15+
float salary;
16+
17+
public Student(int rollno,String name,float fees,String branch,int year,int sem,int age,float salary) {
18+
this.rollno = rollno;
19+
this.name = name;
20+
this.fees = fees;
21+
this.branch = branch;
22+
this.year = year;
23+
this.sem = sem;
24+
this.age = age;
25+
clg="PU";
26+
this.salary=salary;
27+
}
28+
@Override
29+
public String toString() {
30+
return rollno + " "+ name + " " + fees + " " + branch + " " + year + sem + " " + age + " " + clg + " "+salary+"\n";
31+
}
32+
}
33+
class AgeComparator implements Comparator {
34+
public int compare(Object o1, Object o2) {
35+
Student s1=(Student)o1;
36+
Student s2=(Student)o2;
37+
if(s1.age==s2.age)
38+
return 0;
39+
else if(s1.age>s2.age)
40+
return 1;
41+
else
42+
return -1;
43+
}
44+
}
45+
class SalaryComparator implements Comparator{
46+
public int compare(Object o1, Object o2) {
47+
Student s1 = (Student) o1;
48+
Student s2 = (Student) o2;
49+
if (s1.salary == s2.salary)
50+
return 0;
51+
else if (s1.salary > s2.salary)
52+
return 1;
53+
else
54+
return -1;
55+
}
56+
}
57+
58+
class NameComparator implements Comparator{
59+
public int compare(Object o1, Object o2) {
60+
Student s1=(Student)o1;
61+
Student s2=(Student)o2;
62+
return s1.name.compareTo(s2.name);
63+
}
64+
}
65+
class FeesComparator implements Comparator {
66+
public int compare(Object o1,Object o2) {
67+
Student s1=(Student)o1;
68+
Student s2=(Student)o2;
69+
if(s1.fees==s2.fees)
70+
return 0;
71+
else if(s1.fees>s2.fees)
72+
return 1;
73+
else
74+
return -1;
75+
}
76+
}
77+
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package EXPERIMENT2;
2+
3+
import java.util.ArrayList;
4+
import java.util.Collections;
5+
import java.util.Iterator;
6+
7+
public class TEMP1 {
8+
9+
public static void main(String[] args) {
10+
// TODO Auto-generated method stub
11+
ArrayList sl=new ArrayList();
12+
sl.add(new Student(1,"Shiva",10000.00f,"cse",1,1,18,20000.00f));
13+
sl.add(new Student(2,"Venky",15000.00f,"ise",1,2,20,25000.00f));
14+
sl.add(new Student(3,"Jesus",17000.00f,"ece",1,1,19,30000.00f));
15+
sl.add(new Student(3,"Alla",12000.00f,"eee",1,1,19,30000.00f));
16+
sl.add(new Student(3,"Budha",11000.00f,"mech",1,1,21,30000.00f));
17+
System.out.println("Sorting by Name");
18+
System.out.println("_______________");
19+
Collections.sort(sl,new NameComparator());
20+
Iterator itr=sl.iterator();
21+
while(itr.hasNext()){
22+
Student st=(Student)itr.next();
23+
System.out.println(st);
24+
}
25+
System.out.println("Sorting by age");
26+
System.out.println("______________");
27+
Collections.sort(sl,new AgeComparator());
28+
Iterator itr2=sl.iterator();
29+
while(itr2.hasNext()) {
30+
Student st=(Student)itr2.next();
31+
System.out.println(st );
32+
}
33+
System.out.println("Sorting by fees");
34+
System.out.println("______________");
35+
Collections.sort(sl,new FeesComparator());
36+
Iterator itr1=sl.iterator();
37+
while(itr1.hasNext()){
38+
Student st=(Student)itr1.next();
39+
System.out.println(st);
40+
}
41+
System.out.println("Sorting by salary");
42+
System.out.println("______________");
43+
Collections.sort(sl,new SalaryComparator());
44+
Iterator itr3=sl.iterator();
45+
while (itr3.hasNext()) {
46+
Student st = (Student) itr3.next();
47+
System.out.println(st);
48+
}
49+
}
50+
51+
52+
}
53+

EXPERIMENT2/src/module-info.java

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
*
3+
*/
4+
/**
5+
*
6+
*/
7+
module EXPERIMENT2 {
8+
}

EXPERIMENT3/.classpath

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src"/>
9+
<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"/>
10+
<classpathentry kind="output" path="bin"/>
11+
</classpath>

EXPERIMENT3/.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>EXPERIMENT3</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=17
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13+
org.eclipse.jdt.core.compiler.release=enabled
14+
org.eclipse.jdt.core.compiler.source=17

EXPERIMENT3/bin/jdbc/Temp2.class

3.64 KB
Binary file not shown.

EXPERIMENT3/bin/module-info.class

170 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)