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..... i m newly in java ,i want to learn about t
View Tutorial          By: ashwini at 2012-08-09 08:01:34

2. I used the script above, and it seems to work exce
View Tutorial          By: Michael at 2012-05-15 20:50:49

3. hi
View Tutorial          By: raj at 2010-02-12 02:48:09

4. Thanks...it was very helpful :)
View Tutorial          By: Swathi at 2012-01-25 06:49:46

5. thanks, i will try. but can u tell me how to send
View Tutorial          By: ketut joko wibawa at 2011-01-02 05:18:01

6. thanks for suppporting us
View Tutorial          By: sonia at 2010-11-29 00:46:56

7. the below error can be solve by another version co
View Tutorial          By: prasad raju v at 2010-04-08 04:20:10

8. One of the best
View Tutorial          By: Sudhir at 2009-12-22 01:45:28

9. Thanks for good atricle. But this code will always
View Tutorial          By: Binod Suman at 2009-05-28 09:40:48

10. I am not able to open the rar file, can you please
View Tutorial          By: Chandra at 2008-08-07 10:35:59