004 Java Classes
004 Java Classes
By
Black-clouds
typ
Name - What is it ? e
Student, Employee, BankAccount, Document, Car, Box…..
Properties,
Attributes -What describes it ? data
name, salary, balance, size, color, width…..
operatio
Behavior - What can it do ? ns
read, play, search, save, create, print, close, open, deposit
Example class
Attributes -
name, AccNo, balance, dateOpened, accountType, branch
Behavior open(
- ), close( ), deposit( ), withdraw( )
Example class
A class is represented in a rectangle box with 3 rows..
ClassName
BankAccount Rahul Asha Jayasree
12345 54321 67894
List
name Creating
1500
3/5/2014
1800
3/6/2013
15000
23/5/2014
Of
accountNumber
Attributes
balance objects is
Savings
Sec’bad
Savings
HYD
Current
Sec’bad
.dateOpened
.accountType called
open() open() open()
branch
instantiation
close()
deposit()
close()
deposit()
close()
deposit()
List withdraw() withdraw() withdraw()
open( )
Of
close( )
Operations RahulAcct AshaAcct JayaAcct
deposit( )
.
withdraw( )
.
class BankAccount
BankAccount
{
nameString name ;
int accountNumber;
accountNumber
balance
double balance ;
dateOpened
String dateOpened;
accountType
String accountType;
branch
String branch;
open(
void
) open( ){….}
void
close( ) close( ){….}
deposit(
void )deposit( ){….}
withdraw(
void withdraw(
) ){….}
}
}
Classes in
Next….
Java Programming