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 have a project, and need help please. I ne
View Tutorial          By: kelvin65 at 2009-05-25 10:03:07

2. please send detail informatoin about j2me.. send a
View Tutorial          By: Saranya at 2011-07-06 03:00:21

3. I want to creat a bilingual dictionary for mobile
View Tutorial          By: Maryam at 2011-01-25 02:28:44

4. i need help for my study, i need an algorithm for
View Tutorial          By: Vincent at 2011-08-17 13:37:52

5. Java is very interesting,I wish to do certificate
View Tutorial          By: Dzunisani Chauke at 2012-11-05 10:19:35

6. Thank you!!
View Tutorial          By: Diego at 2015-07-16 21:11:58

7. i want full of information abt java
View Tutorial          By: sagar at 2010-08-23 06:42:40

8. I want to know that what is the main use of the &q
View Tutorial          By: Krunal Patel at 2012-09-17 08:11:19

9. hey usharadha and all other friends...i hv taken a
View Tutorial          By: abdur at 2012-02-03 15:56:10

10. hi! i want to know about how database createed in
View Tutorial          By: kundan at 2010-05-19 05:03:33