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



Ask a Question

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. how to show text in tab menu & when i selected
View Tutorial          By: shadah at 2012-05-05 14:14:37

2. thanx mitra...it helped alot.
View Tutorial          By: psuyog at 2014-10-10 12:16:26

3. provided examples are very useful.
View Tutorial          By: Technical Guy at 2010-04-25 08:12:06

4. just looking for it, useful!
View Tutorial          By: ymfeng at 2009-03-20 00:09:56

5. Actually i had downloaded all the files but it thr
View Tutorial          By: bornwithpowers at 2009-11-11 04:48:21

6. hi!!!!!!!!! MR. RAMLAK will u plz tell the methode
View Tutorial          By: balwant at 2008-11-10 17:19:44

7. Hello,
i was run your given program in ecli

View Tutorial          By: vishnu chauhan at 2013-01-24 11:42:16

8. The static variables are not in object scope inste
View Tutorial          By: Karthick at 2011-06-29 06:55:17

9. date span progarm sorce code in jsp by using strin
View Tutorial          By: prudhvi at 2013-01-27 13:55:09

10. This works with inserts but it is very slow for lo
View Tutorial          By: Antonio Pereira at 2011-02-04 08:54:45