import
java.io.*;
class
Const1
{
private int sno;
private String sname;
Const1()
{
System.out.println("Constructor Called");
sno = 0;
sname = "";
}
void getdetails() throws IOException
{
BufferedReader br = new
BufferedReader(new InputStreamReader(System.in));
String line;
System.out.print("Enter
Sno : ");
line = br.readLine();
sno = Integer.parseInt(line);
System.out.print("Enter
Sname : ");
sname = br.readLine();
}
void putdetails()
{
System.out.println("Sno :
" + sno);
System.out.println("Sname
: " + sname);
}
public static void main(String args[])
throws IOException
{
Const1 c1 = new Const1();
c1.putdetails();
c1.getdetails();
c1.putdetails();
}
}
No comments:
Post a Comment