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. I just copied this example to my app. It's not wor
View Tutorial          By: Praveen Kumar at 2011-11-17 12:59:40

2. its amazing for me i learn a lot from it thanks..
View Tutorial          By: sufyan at 2014-10-26 14:39:34

3. it's nice linking up here
View Tutorial          By: kasadha at 2010-10-28 10:34:36

4. give an recursive example using string
View Tutorial          By: sauk at 2011-08-22 16:16:41

5. thank you so much. i've been fixing this problem o
View Tutorial          By: yo at 2011-06-05 13:25:37

6. it's really Nice Clock
View Tutorial          By: Mido at 2007-09-09 08:45:49

7. Easy to understand... thank u....
View Tutorial          By: saranya at 2013-02-11 10:37:07

8. pls help me .....its hard to understand for me th
View Tutorial          By: heidi at 2010-06-27 02:31:29

9. hello!
I am so confused and a total beginne

View Tutorial          By: Jena at 2011-06-11 17:39:39

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