I am very new to Java. My assignment is to create my own method and then create a class to test it in. My question, do I create the method separate of the class, or within the class? If it is separate of the class, how do I get the class to access my method?
(Are they saved as two separate files?)
This is what I have so far, but I am getting an error that I have to initialize KILOWATT in class DWindmill. I thought I did already in the method??? Any suggestions?
//This is the method Windmill
import java.util.*;
import static java.lang.Math.*;
class DWindmill {
public static void Windmill(){
//create the method for the Windmill class
int miles = 50;
//int miles = 200;
//int miles = 250;
int KILOWATT = (miles / 50);}
static Scanner console = new Scanner(System.in);
{
System.out.println("Enter miles per hour:");
miles = console.nextInt();
Windmill();
System.out.println(+ KILOWATT + "kilowatts");
}
}