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. Wow Such a good tutorial. It really really make me
View Tutorial          By: Anonymous at 2010-02-19 05:53:11

2. thanks..very nice and easy to understand for new j
View Tutorial          By: Ranjan at 2011-07-22 08:34:50

3. you can see this page: http://devlinslab.blogspot.
View Tutorial          By: luis at 2011-11-08 06:46:23

4. hi! this coding is very helpful for me thanks .
View Tutorial          By: bhuvaneshwari at 2009-10-18 23:52:58

5. #!/bin/bash

echo "Enter number

View Tutorial          By: ashish at 2011-03-25 07:46:09

6. could somebody please tell a case where memcpy() w
View Tutorial          By: freak at 2011-02-09 20:29:26

7. required the flag set loop stutruce .............
View Tutorial          By: savita at 2013-05-12 04:52:30

8. thanks for all samples..
View Tutorial          By: 珠洲市 at 2013-03-01 09:47:46

9. I have been trying to learn ASP.net for a week and
View Tutorial          By: eric at 2010-08-06 15:43:49

10. It's good but not easily understandable....
View Tutorial          By: koshal at 2010-12-19 23:32:05