import java.lang.*;
import java.io.*;
class emp implements Serializable
{
int eno;
String name;
double sal;
void display()
{
System.out.println(eno+"\t"+name+"\t"+sal);
}
}
public class file
{
public static void main(String
args[]) throws IOException
{
emp e=new emp();
ObjectOutputStream oos=null;
ObjectInputStream ois=null;
BufferedReader br=new
BufferedReader(new InputStreamReader(System.in));
System.out.println("enter how
many employees");
int
n=Integer.parseInt(br.readLine());
oos=new ObjectOutputStream(new
BufferedOutputStream(new FileOutputStream("emp")));
try
{
for(int i=0;i<n;i++)
{
System.out.println("enter the
employee number");
e.eno=Integer.parseInt(br.readLine());
System.out.println("enter the
employee name");
e.name=br.readLine();
System.out.println("enter the
salary");
e.sal=Double.parseDouble(br.readLine());
oos.writeObject(e);
oos.reset();
}
oos.close();
}
catch(NotSerializableException ne)
{
System.out.println(ne);
}
catch(InvalidClassException ie )
{
System.out.println(ie);
}
catch(IOException ioe)
{
System.out.println(ioe);
}
System.out.println("reading
objects from the file");
ois=new ObjectInputStream(new
BufferedInputStream(new FileInputStream("emp")));
try
{
for(int i=0;i<n;i++)
{
emp e1=(emp)ois.readObject();
e1.display();
}
ois.close();
}
catch(ClassNotFoundException ce )
{
System.out.println(ce);
}
catch(IOException ioe)
{
System.out.println(ioe);
}
}//end of main();
}//end of class
SQL> select * from user_source;
NAME TYPE LINE TEXT
--------------------------------------------------------------------------------
PROC2 PROCEDURE 1 procedure proc2(n number , nm out
varchar) //this is the original source code line
PROC2 PROCEDURE 3 begin
PROC2 PROCEDURE 4 select name into nm from emp10 where
id=n;
PROC2 PROCEDURE 5 end proc2;
కామెంట్లు లేవు:
కామెంట్ను పోస్ట్ చేయండి