class
employee
{
private int eno;
private String ename;
public void setemp(int no,String name)
{
eno = no;
ename = name;
}
public void putemp()
{
System.out.println("Empno
: " + eno);
System.out.println("Ename
: " + ename);
}
}
class
department extends employee
{
private int dno;
private String dname;
public void setdept(int no,String name)
{
dno = no;
dname = name;
}
public void putdept()
{
System.out.println("Deptno
: " + dno);
System.out.println("Deptname : " + dname);
}
public static void main(String args[])
{
department d = new
department();
d.setemp(100,"aaaa");
d.setdept(20,"Sales");
d.putemp();
d.putdept();
}
}
super () -> Keyword used to call
the base constructor;
This program is Very easy to understand n easy to explain for some1 .........
ReplyDeleteI am technical writer of http://www.kriblog.com, I would like to thanks you for writing a very good article.
ReplyDeletehi very easy step this program.I would like thank u ......
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteEc
ReplyDeleteTank u
Very useful for beginners
ReplyDeleteVery useful for beginners
ReplyDeletei found the solution through out this blog about Single inheritance with example program..java training in chennai
ReplyDeleteGiven so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more .
ReplyDeletejava training in chennai
Can you do with coomand line arguments
ReplyDelete