btap0644
August 4th, 2009, 11:08 PM
i want to a method to return an integer value and print it outside the method
here is my code
public class returnvariable{
public static void main (String[] args) {
public int getFloor(){
int currentFloor = 2;
return currentFloor;
}
int curFloor = getFloor();
System.out.println("Answer is: " + curFloor);
}
}
here is my code
public class returnvariable{
public static void main (String[] args) {
public int getFloor(){
int currentFloor = 2;
return currentFloor;
}
int curFloor = getFloor();
System.out.println("Answer is: " + curFloor);
}
}