Thu Dec 10, 2009 6:17 pm
class Boat {
int calcDir() {
int direction = 2;
return direction;
}
}
public class Control {
public static void main(String args[]){
Boat boat = new Boat();
boat.calcDir();
System.out.println(direction);
}
}
class Boat {
int direction;
int calcDir() {
return direction + 1;
}
}
public class Control {
public static void main(String args[]){
int direction = 2;
Boat boat = new Boat();
System.out.println(boat.calcDir());
}
}
Sat Dec 12, 2009 11:56 pm
Sun Dec 13, 2009 8:13 pm
Sun Dec 27, 2009 1:53 am
class Boat {
int calcDir() {
int direction = 2;
return direction;
}
}
public class Control {
public static void main(String args[]){
//Declare a variable to hold the return value of calcDir()
int tempDir = 0;
Boat boat = new Boat();
//Use the calcDir() method to fill the value of tempDir
tempDir = boat.calcDir();
//Print the value
System.out.println(tempDir);
}
}
class Boat {
int calcDir(int tVal) {
//Pass in a value as a parameter to the calcDir() method
//This Value will get incremented by 1
return tVal + 1;
}
}
public class Control {
public static void main(String args[]){
int direction = 2;
Boat boat = new Boat();
System.out.println(boat.calcDir(direction));
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.