
-----------------------------------
LOL123
Wed Apr 14, 2010 8:19 pm

Cant get Methods
-----------------------------------
Hi,
I need to make a program that calculates the area of a circle. I have to get the input then use a method to calculate the area. I dont really understand methods I have read wtd's tutorial but still a bit unclear on how to create the method in my program and make it do what I need it to. 
This is my code so far:

[code]
import java.io.*;
class method
{
  public static void main (String args [])
    throws java.io.IOException
  {
    BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
    
    int radius = 0;
    String input = "";
    radius = Integer.parseInt (input);
    System.out.println ("Please enter a number from the radius of a circle.");
    input = br.readLine();
   }
}
[/code]

-----------------------------------
TheGuardian001
Wed Apr 14, 2010 8:41 pm

Re: Cant get Methods
-----------------------------------
You know that 

class MyClass
{
    public static void main(String

-----------------------------------
slider203
Wed Apr 14, 2010 10:17 pm

Re: Cant get Methods
-----------------------------------
Also if you want your method stored in a diffrent file you can use code like this:
[code]
class 
{
    variables used

public static int area()
{

  steps in method

}
}
[/code]

You will have to use an object to access the method in your program though.
