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. MSComm1.Settings="9600,n,8,1"

View Tutorial          By: ali at 2012-02-25 21:52:21

2. pls give me code for exact communication between
View Tutorial          By: SIRAJ at 2009-02-19 06:24:10

3. sir i m getting chat server started bt how a clien
View Tutorial          By: ashu at 2010-11-02 08:13:00

4. all are easy to understanding codes. . . thanks
View Tutorial          By: kadhir at 2011-06-27 03:33:30

5. lllllllllllllllllllllllllllllike
View Tutorial          By: duck at 2015-04-10 19:19:47

6. Hi got an error while executing :

j

View Tutorial          By: Hi, at 2009-07-06 01:09:35

7. How to draw a thick circle in midlet?
View Tutorial          By: masi at 2011-12-01 11:47:00

8. what about strings in J2ME ?
View Tutorial          By: Swapnil at 2012-07-20 09:19:15

9. i like java language.
View Tutorial          By: deepika at 2014-09-22 15:11:39

10. dear sir, plz answer my following questions:

View Tutorial          By: hawa at 2012-01-29 08:29:39