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
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. <%!
DateFormat date = DateFormat.getDat
View Tutorial By: saifuctg at 2011-12-30 22:24:54
2. can anyone explain the output of this recursive ex
View Tutorial By: vipul at 2012-08-12 19:41:19
3. sir the program is
error: error reading C:
View Tutorial By: Yashovardhan at 2008-05-05 21:42:27
4. Try this
import java.net.*;
View Tutorial By: Asad at 2014-02-13 05:55:26
5. thank you...as a beginner this info very useful fo
View Tutorial By: snigdha at 2012-10-17 11:41:39
6. Can I ask something,
Can you show m
View Tutorial By: wawa at 2014-05-03 15:28:35
7. Introduction is very clear I get the answer what I
View Tutorial By: sathya at 2013-02-05 15:57:30
8. I need full code for how to connnect pc to mobile
View Tutorial By: Vijay at 2009-08-23 23:38:05
9. sir, i need java code to display position and velo
View Tutorial By: Sandhya Yadav at 2015-08-20 07:16:04
10. i need save,delete,update use arrayList.
th
View Tutorial By: kyaw at 2010-04-07 01:55:02