Results 1 to 7 of 7
- 08-28-2009, 06:58 PM #1
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
';' expected, not of the common kind..
Hai!
Im totaly lost when it comes to returning an array..
So heres my script, Idk why I thinks my method is a statement but it does..
So can you help me?
Script:
PHP Code:import static java.lang.System.out; import java.util.Scanner; public class Speecher { public static void main(String[] args) { // TODO, add your application code out.println("Wellcome to speecher!"); Scanner text = new Scanner(System.in); String chat = ""; chat = text.nextLine(); String words[] = getWords(chat); for (x = 0;x<words.length;x++){ out.print(words[x]); } } private static String getWords[](String chat){ //ArrayList<String> list = new ArrayList<String>(); String list = chat.split(" "); return list; } }
- 08-28-2009, 07:02 PM #2
try this instead:
Java Code:private static String[] getWords(String chat){ //ArrayList<String> list = new ArrayList<String>(); String[] list = chat.split(" "); return list; }My Hobby Project: LegacyClone
- 08-28-2009, 07:09 PM #3
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
thnx this helps alot =)
- 08-31-2009, 04:14 AM #4
Member
- Join Date
- Jul 2009
- Posts
- 4
- Rep Power
- 0
It was useful ... I was also facing the same problem with one of my program
- 08-31-2009, 04:36 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Java doc contains all the information related to this lol. If you read it carefully, this is not a big deal. As a habit try to work around with Java doc as well, you can learn a lot. Good luck :)
- 08-31-2009, 07:45 PM #6
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
unlike in c/c++, a string is not simple an array of characters. and an arraylist is not an array. also, you never declare your 'x' variable, unless you didn't post your complete code
- 09-02-2009, 04:37 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
yes, we cannot see any declaration for 'x' at all. Seems it's the complete code.
Similar Threads
-
How to get Home directory using Common Net ftp api?
By cprash.aggarwal in forum NetworkingReplies: 1Last Post: 03-01-2009, 05:37 PM -
how client know what kind of server
By lemur in forum NetworkingReplies: 3Last Post: 05-31-2008, 07:11 AM -
Total Newbie, Be Kind :)
By dazza-s in forum New To JavaReplies: 11Last Post: 04-26-2008, 10:54 PM -
Where i have to write the common data to jsp
By trill in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 08-07-2007, 07:35 AM -
Will make a pyramid of some kind out of a number
By romina in forum New To JavaReplies: 1Last Post: 08-07-2007, 05:20 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks