class or interface expected

hi guys, i've been trying to create a new method but I also get this 'class or interface expected' error. could you tell me what I'm doing wrong?

import java.util.Scanner;

public class FishShopApp1

{

public static void main (String [] args)

{

Scanner sc = new Scanner (System.in);

double baseArea, height, contents;

int choice = 0;

int opt = 0;

double amt;

//First fish tank

System.out.print("Enter base area: ");

baseArea = sc.nextDouble(); sc.nextLine();

System.out.print("Enter height of fish tank: ");

height = sc.nextDouble(); sc.nextLine();

System.out.print("Enter contents: ");

contents = sc.nextDouble(); sc.nextLine();

FishTank fishTankOne = new FishTank(baseArea, height, contents);

//Second fish tank

System.out.print("Enter base area: ");

baseArea = sc.nextDouble(); sc.nextLine();

System.out.print("Enter height of fish tank: ");

height = sc.nextDouble(); sc.nextLine();

System.out.print("Enter contents: ");

contents = sc.nextDouble(); sc.nextLine();

FishTank fishTankTwo = new FishTank(baseArea, height, contents);

//Third fish tank

System.out.print("Enter base area: ");

baseArea = sc.nextDouble(); sc.nextLine();

System.out.print("Enter height of fish tank: ");

height = sc.nextDouble(); sc.nextLine();

System.out.print("Enter contents: ");

contents = sc.nextDouble(); sc.nextLine();

FishTank fishTankThree = new FishTank(baseArea, height, contents);

do

{

System.out.println("Fish Shop Menu");

System.out.println("=================================");

System.out.println("1. Add water to fish tank");

System.out.println("2. pour water from one tank to another");

System.out.println("3. Show biggest contents");

System.out.println("4. Exit");

System.out.print("Please choose an option: ");

opt = sc.nextInt(); sc.nextLine();

switch(opt)

{

case 1:

addWater(sc, fishTankOne, fishTankTwo, fishTankThree, amt);

break;

case 2:

break;

case 3:

break;

default:

break;

}

}while (opt!=4);

}

}

public static void addWater(FishTank fishTankOne,fishTankTwo, fishTankThree, double amt)

{

Scanner sc = new Scanner(System.in);

double baseArea, height, contents;

int choice = 0;

int opt = 0;

double amt;

if (choice == 1)

{

System.out.print("Now, enter the amount of water to be added in: ");

amt = sc.nextDouble(); sc.nextLine();

fishTankOne.addIn(+amt);

if (+amt < baseArea * height)

{

System.out.println("Water added in successfully.");

}

else

{

System.out.println("Too much water, fish tank will overflow.");

}

}

else if (choice == 2)

{

System.out.print("Now, enter the amount of water to be added in: ");

amt = sc.nextInt(); sc.nextLine();

fishTankTwo.addIn(+amt);

if (+amt < baseArea * height)

{

System.out.println("Water added in successfully.");

}

else

{

System.out.println("Too much water, fish tank will overflow.");

}

}

else if (choice == 3)

{

System.out.print("Now, enter the amount of water to be added in: ");

amt = sc.nextInt(); sc.nextLine();

fishTankThree.addIn(+amt);

if(+amt < baseArea * height)

{

System.out.println("Water added in successfully.");

}

else

{

System.out.println("Too much water, fish tank will overflow.");

}

}

else

{

System.out.println("Invalid option");

}

}

the error I get it

FishShopApp1.java:98: 'class' or 'interface' expected

public static void addWater(FishTank fishTankOne,fishTankTwo, fishTankThree, double amt)

^

1 error

Thanks in advance

[4090 byte] By [Farawaya] at [2007-10-3 2:42:40]
# 1

in java, methods need to be declared inside the class definition

i.e.class A {

void myMethod(){}

}

you've currently got

class A{

}

void myMethod(){}

which is not allowed (this differs from C++)

asjfa at 2007-7-14 20:30:56 > top of Java-index,Developer Tools,Java Compiler...
# 2

thanks for the help, i declared insde the class definition and now i get another error which is:

FishShopApp1.java:95: <identifier> expected

public static void addWater(FishTank fishTankOne,fishTankTwo, fishTankThree, double amt)

^

FishShopApp1.java:166: ')' expected

Farawaya at 2007-7-14 20:30:56 > top of Java-index,Developer Tools,Java Compiler...
# 3
Every parameter needs a type, not just the first.You need to study up the language syntax really, asking here is surely too slow.
ejpa at 2007-7-14 20:30:56 > top of Java-index,Developer Tools,Java Compiler...