Comment on Tutorial - Inner Class Example in Java By Tamil Selvan



Comment Added by : shahalam shaikh

Comment Added at : 2012-02-13 21:08:30

Comment on Tutorial : Inner Class Example in Java By Tamil Selvan
here is one more inner class example
public class Account {
protected static int accNo=1000025475;
protected String accHolderName;
protected double bal;
public Account()
{
super();
}
public Account(String accHolderName, double bal)
{
super();
accNo++;
this.accHolderName = accHolderName;
this.bal = bal;
}
@Override
public String toString() {
return "accNo="+accNo+"\naccHolderName=" + accHolderName + ", \nbal=" + bal
+"\n************************";
}
public static class Locker
{
int lockerId=2542;

public Locker()
{
super();
lockerId++;
}

@Override
public String toString() {
return "LockerId="+lockerId;
}

}
public static void main(String[] args){

Locker l1=new Locker();
System.out.println(l1);
Account a2=new Account("saleem",5125.24);
System.out.println(a2);
Locker l2=new Locker();
System.out.println(l2);
Account a3=new Account("arif",15847);
System.out.println(a3);
}
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Thanx!!!!....
It helped me to startup with

View Tutorial          By: RAJITHA REDDY at 2011-03-01 02:47:03

2. this is the one of the best site to search java pr
View Tutorial          By: gautam gorai at 2009-01-13 06:44:15

3. Thanks a lot.
View Tutorial          By: Manna at 2008-07-07 22:18:49

4. i want to open pdf file from sd card and i dont wa
View Tutorial          By: Karan Mavadhiya at 2013-01-30 12:02:30

5. Can please send me codes to pass strings or text f
View Tutorial          By: bryan at 2009-12-29 05:59:21

6. i wnt develope application on cal time send messag
View Tutorial          By: saurab at 2012-10-11 12:02:52

7. i have a program in which we have to find the summ
View Tutorial          By: Navjyot at 2013-01-28 10:38:55

8. Thank you for your help !
View Tutorial          By: vadym at 2010-03-03 06:35:01

9. Thanks for your nice article.I learned a lot
View Tutorial          By: Mahyar at 2012-08-12 12:09:36

10. A lucid explanantion is "when a method name i
View Tutorial          By: harshnil at 2013-01-15 03:57:44