Why "illegal start of expression" error? Please help!

Hello great java minds. Could you please tell me why I get "illegal start of expression" errors for the following headers? Thanks for your wisdom!!

Lines generating this error:

publicstatic String getName()

--and--

publicstaticvoid displayResults()

Here is my first class (that includes this code):

import java.io.*;

import java.util.*;

publicclass ProductSurvey

{

publicstaticvoid main(String [] args)

{

ProductData myData =new ProdcutData();

String name = getName();

openFile();

myData.setName(name);

myData.dataRetrieve(name);

myData.updateAverages(rating1totalLow, rating2totalLow, rating3totalLow, rating1totalMed, rating2totalMed, rating3totalMed, rating1totalHigh, rating2totalHigh, rating3totalHigh, inc1total, inc2total, inc3total);

mydata.setRating2ave1lower3(rating2lower1than3, lower1than3Total);

displayResults();

publicstatic String getName()

{

System.out.println("Please enter income and product info file name: ");

Scanner keyboard =new Scanner(System.in);

String name = keyboard.next();

return name;

}

publicstaticvoid openFile();

{

File fileObject =new File(name);

while ((! fileObject.exists()) || ( ! fileObject.canRead()))

{

if( ! fileObject.exists())

{

System.out.println("No such file");

}

else

{

System.out.println("That file is not readable.");

}

System.out.println("Enter file name again:");

name = keyboard.next();

fileObject =new File(name);

}

}

publicstaticvoid displayResults()

{

System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");

System.out.println("*Average (rounded) product ratings, by income bracket, are as follows: ");

System.out.println(myData.toString());

System.out.print("\n*Total number of persons in Income Bracket $50000-$74999 ");

System.out.print("that rated all three products with a score of 5 ");

System.out.println("or higher: " + myData.getHighRaters());

System.out.print("\n*Average (rounded) rating for Product 2 by ");

System.out.println("persons who rated Product 1 lower than Product 3: " + myData.rating2ave1lower3);

}

}

}

Here is the backup class (just for your reference):

import java.util.*;

import java.io.*;

class ProductData

{

private String name;

privateint lineCount;

privatedouble inc1total;

privatedouble inc2total;

privatedouble inc3total;

privateint rating1totalLow;

privateint rating2totalLow;

privateint rating3totalLow;

privateint rating1totalMed;

privateint rating2totalMed;

privateint rating3totalMed;

privateint rating1totalHigh;

privateint rating2totalHigh;

privateint rating3totalHigh;

privateint highRaters;

privatedouble lower1than3Total;

privateint rating2lower1than3;

privatelong rating2ave1lower3;

privatelong rating1averageLow;

privatelong rating2averageLow;

privatelong rating3averageLow;

privatelong rating1averageMed;

privatelong rating2averageMed;

privatelong rating3averageMed;

privatelong rating1averageHigh;

privatelong rating2averageHigh;

privatelong rating3averageHigh;

public ProductData()

{

name =null;

lineCount = 0;

inc1total = 0;

inc2total = 0;

inc3total = 0;

rating1totalLow = 0;

rating2totalLow = 0;

rating3totalLow = 0;

rating1totalMed = 0;

rating2totalMed = 0;

rating3totalMed = 0;

rating1totalHigh = 0;

rating2totalHigh = 0;

rating3totalHigh = 0;

highRaters = 0;

lower1than3Total= 0;

rating2lower1than3 = 0;

rating1averageLow = 0;

rating2averageLow = 0;

rating3averageLow = 0;

rating1averageMed = 0;

rating2averageMed = 0;

rating3averageMed = 0;

rating1averageHigh = 0;

rating2averageHigh = 0;

rating3averageHigh = 0;

}

publicvoid setName(String newName)

{

String name = newName;

}

publicvoid dataRetrieve(String name)

{

try

{

BufferedReader inputStream =new BufferedReader(new FileReader(name));

String trash ="No trash yet";

while ((trash = inputStream.readLine()) !=null)

{

StringTokenizer st =new StringTokenizer(trash);

int income = Integer.parseInt(st.nextToken());

int rating1 = Integer.parseInt(st.nextToken());

int rating2 = Integer.parseInt(st.nextToken());

int rating3 = Integer.parseInt(st.nextToken());

if(rating1<rating3)

{

lower1than3Total++;

rating2lower1than3 = rating2lower1than3 + rating2;

}

if(income><50000)

{

rating1totalLow = rating1totalLow + rating1;

rating2totalLow = rating2totalLow + rating2;

rating3totalLow = rating3totalLow + rating3;

inc1total++;

}

elseif(income<75000)

{

rating1totalMed = rating1totalMed + rating1;

rating2totalMed = rating2totalMed + rating2;

rating3totalMed = rating3totalMed + rating3;

inc2total++;

if((rating1>=5) && (rating2>=5) && (rating3>=5))

{

highRaters++;

}

}

elseif(income<100000)

{

rating1totalHigh = rating1totalHigh + rating1;

rating2totalHigh = rating2totalHigh + rating2;

rating3totalHigh = rating3totalHigh + rating3;

inc3total++;

}

lineCount++;

}

inputStream.close();

}

catch(IOException e)

{

System.out.println("Problem reading from file.");

}

}

publicvoid updateAverages(int rating1totalLow,int rating2totalLow,int rating3totalLow,int rating1totalMed,int rating2totalMed,int rating3totalMed,int rating1totalHigh,int rating2totalHigh,int rating3totalHigh,long inc1total,long inc2total,long inc3total)

{

rating1averageLow = Math.round(rating1totalLow/inc1total);

rating2averageLow = Math.round(rating2totalLow/inc1total);

rating3averageLow = Math.round(rating3totalLow/inc2total);

rating1averageMed = Math.round(rating1totalMed/inc2total);

rating2averageMed = Math.round(rating2totalMed/inc2total);

rating3averageMed = Math.round(rating3totalMed/inc2total);

rating1averageHigh = Math.round(rating1totalHigh/inc3total);

rating2averageHigh = Math.round(rating2totalHigh/inc3total);

rating3averageHigh = Math.round(rating3totalHigh/inc3total);

}

publiclong setRating2ave1lower3(int rating2lower1than3,double lower1than3Total)

{

long rating2ave1lower3 = (rating2lower1than3/lower1than3Total);

return rating2ave1lower3;

}

public String toString()

{

return ("\nIncome level $26000-$49999:" +"\n" +"-Product 1: "

+ rating1AverageLow +"-Product 2: " + rating2AverageLow

+"-Product 3: " + rating3AverageLow +"\n" +"\n" +"Income level $50000-$74999:" +"\n" +"-Product 1: "

+ rating1AverageMed +"-Product 2: " + rating2AverageMed

+"-Product 3: " + rating3AverageMed +"\n" +"\n" +"Income level $75000-$100000:" +"\n" +"-Product 1: "

+ rating1AverageHigh +"-Product 2: " + rating2AverageHigh

+"-Product 3: " + rating3AverageHigh);

}

publicint getHighRaters()

{

return highRaters;

}

}

[14083 byte] By [JavaBeginner98a] at [2007-10-2 16:04:43]
# 1
You're trying to define those methods inside another method (the "main" method, in this case). Don't do that.
warnerjaa at 2007-7-13 16:40:45 > top of Java-index,Java Essentials,New To Java...