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. It can be Made Popular by adding Links or Suggesti
View Tutorial          By: Ramalingam at 2010-03-20 23:00:41

2. its nice example for beginers
View Tutorial          By: Ramesh at 2012-02-15 18:13:09

3. There is no need to fight. ...whatever ku is sayin
View Tutorial          By: saurabh at 2009-07-30 15:19:49

4. very usefull article............ thanks to the aut
View Tutorial          By: runa at 2010-10-16 08:43:38

5. i wanted to know the rules how they are used like
View Tutorial          By: shlok gupta at 2012-03-24 11:44:24

6. pls send me the brief description about jdbc conne
View Tutorial          By: vikas at 2011-08-09 07:07:53

7. In case your having trouble

1 the a

View Tutorial          By: Sin at 2013-01-17 05:40:37

8. Nice example to understand what does the string T
View Tutorial          By: vikash from india at 2011-06-23 06:39:03

9. if i wanna push the data from my keyboard input, h
View Tutorial          By: andys at 2008-11-09 03:09:32

10. What is this....for simple question every one was
View Tutorial          By: Kaify at 2011-07-27 21:35:52