Wednesday, March 3, 2010

4th

so sleepy..
hv nothing to else say other than what i got at class...

here it is...

menu:
-argument/parameters
-passing obj to method
-constructor
-info hiding dan visibility modifiers
-local vars


info hiding
-the differences are between public or private
-with public,the info is accesible for other class
-with private it is not
-to access it,we need to use method

method
-syntax
( )
-arg# is the parameters which given the method a value to process
-there can be multiple parameters in a method by adding comma between each parameters

get the return value from method
-example
public double getBalance(){
return balance;
}

constructor
-is a special method thats executed when a new instance of class is created
-generated by compiler automatically when the file compiled

passing obj to method
-using object as a parameter in a method

local variables
-generated within a method,known only to that method
-example
public void swapBalance(Account vice,Account versa){
//tempBalance is a local var
double tempBalance=vice.getBalance();
vice.setBalance(versa.getBalance());
versa.setBalance(tempBalance);

thats all...

goin to sleep...

No comments:

Post a Comment