.class error

What does it mean when you're getting a "methods.java:23: '.class' expected"error in your method for the return line?
[141 byte] By [cherbearaua] at [2007-10-2 16:21:18]
# 1
It probably means that you've messed up the closing brackets.
PhHeina at 2007-7-13 17:16:50 > top of Java-index,Java Essentials,Java Programming...
# 2

am I just missing something obvious?

public class methods

{

public static String translate (String sentence)

{

String temp;

String result[] = new String[10];

int i=0;

Scanner scan = new Scanner (sentence);

temp = scan.next();

while (scan.hasNext())

{

result = temp;

i++;

}

return result[];

}

}

cherbearaua at 2007-7-13 17:16:50 > top of Java-index,Java Essentials,Java Programming...
# 3

i had to replace my i variable with s because it was italicizing everything

public class methods

{

public static String translate (String sentence)

{

String temp;

String result[] = new String[10];

int s=0;

Scanner scan = new Scanner (sentence);

temp = scan.next();

while (scan.hasNext())

{

result[s] = temp;

s++;

}

return result[];

}

}

cherbearaua at 2007-7-13 17:16:50 > top of Java-index,Java Essentials,Java Programming...
# 4

Your method is public static String translate (String sentence) but you try to return a String[].

When you post code, please use[code] and [/code] tags as described in [url=http://forum.java.sun.com/help.jspa?sec=formatting ]Formatting tips[/url] on the message entry page. It makes it much easier to read.

PhHeina at 2007-7-13 17:16:50 > top of Java-index,Java Essentials,Java Programming...
# 5

will do, thanks for the tip.....I'm still getting the same error...this is my modified code:

import java.util.Scanner;

public class methods

{

public static String[] translate (String sentence)

{

String temp;

String result[] = new String[10];

int i=0;

Scanner scan = new Scanner (sentence);

temp = scan.next();

while (scan.hasNext())

{

result[i] = temp;

i++;

}

return result[];

}

}

cherbearaua at 2007-7-13 17:16:50 > top of Java-index,Java Essentials,Java Programming...
# 6
nevermind....it wasn't working because there wasn't a constructor to return the variable designated by the class....I think that's the best way to put it. Thanks!
cherbearaua at 2007-7-13 17:16:50 > top of Java-index,Java Essentials,Java Programming...