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. hi!! friends i executed the code
and i am

View Tutorial          By: chennareddy at 2007-10-15 00:07:30

2. what about strings in J2ME ?
View Tutorial          By: Swapnil at 2012-07-20 09:19:15

3. Excelente!!
Justo lo que necesitaba.

View Tutorial          By: Cesar at 2010-01-07 17:40:52

4. good but not v.good. it seems the author is big fa
View Tutorial          By: Muhammad Ishaq Awan at 2014-10-29 07:00:44

5. Thanks for providing that....
View Tutorial          By: Jothimanickam.M at 2013-04-06 07:35:38

6. M finding difficulty in understanding Java. Can an
View Tutorial          By: Sunil at 2010-09-28 03:54:57

7. Error loading SolarisSerial: java.lang.Unsatisfied
View Tutorial          By: amit doshi at 2009-04-06 02:00:28

8. it is a good example to understand.
View Tutorial          By: nivedha at 2011-07-12 05:15:39

9. thank you for your excellent explaination..! :)
View Tutorial          By: marios at 2012-05-16 16:17:31

10. Thanks a lot for valuable program.


View Tutorial          By: Kailash at 2012-07-30 10:09:12