-2

This is the first part of my code:

import acm.program.*;
public class BisectionMethod extends Program {
public void run () {
 double m, y, E, value;
 double a=readDouble("Enter a");
 double b=readDouble("Enter b");
 double f(double x) {
  return value=readDouble("Enter a function using x.");
 }

After compiling, it tells me "; expected" on ( and ) of the line: double f(double x) {

What am I doing wrong? I'm new to java so I'm sorry if there are any other major mistakes. I am trying to use a function, f(x) which I believe is written the way I have shown, but I keep getting the same error.

Dimi
  • 31
  • 3

1 Answers1

0

You need to take method f outside run method and it will be good.

RockAndRoll
  • 2,247
  • 2
  • 16
  • 35
  • 1
    I understand, I have messed up quite a bit but it was that simple :P Thank you all! – Dimi Nov 03 '15 at 15:03