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
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
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
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program 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
Archived Comments
1. Thank u it helps me alot.....
View Tutorial By: Ramya at 2012-02-22 10:16:14
2. Plz tell me the classes to import for this code an
View Tutorial By: Nitin at 2009-11-10 02:54:50
3. to Donovan Aces #61, thank you, I am new to java &
View Tutorial By: Joe at 2011-09-14 22:40:19
4. it is a big help for us , as a IT student that kn
View Tutorial By: nelson kent recites at 2012-01-19 08:56:26
5. I writing a main class in the eclipse IDE and call
View Tutorial By: adam lim at 2013-03-11 04:13:51
6. Hi, I used your fix and it looks like it worked fi
View Tutorial By: Eddie at 2011-02-21 18:41:06
7. sir i need some simple example of jdbc i cannot un
View Tutorial By: sumit at 2011-11-26 18:02:14
8. i need a source to send and receive SMS through th
View Tutorial By: morteza at 2010-03-03 01:53:09
9. sir,i m doing ME/CSE.i want to know more informati
View Tutorial By: m.rajalakshmi at 2011-07-27 05:20:44
10. hi ashraf , ramlak and all,
i m new here .
View Tutorial By: hemendra at 2009-12-28 21:59:34