|
查看: 1235|回复: 7
|
关于java 小弟初学
[复制链接]
|
|
|
这个code有error不能run...erm...问题是这样的,帮帮小弟的功课吧
Write a program that reads words from user input and displays all the non-duplicate words in ascending order.
import java.util.*;
import java.io.*;
public class testSetQ4 {
public static void main(String[] args) throw IOException {
//create a tree set to hold the words
TreeSet<String> treeSet = new TreeSet<String>();
String line;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the words to be stored in set: ");
line = in.readLine();
// each word is broken into tokens
//add each token to the set
StringTokenizer st = new StringTokenizer(line);
while(st.hasMoreTokens())
treeSet.add(st.nextToken());
System.out.println(treeSet);
}
} |
|
|
|
|
|
|
|
|
|
|
发表于 8-9-2009 10:53 AM
|
显示全部楼层
throws <-----
不是 throw ...... |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 8-9-2009 01:27 PM
|
显示全部楼层
原帖由 兔仙人 于 8-9-2009 10:53 AM 发表 
throws
改了 还是不能run..~~ |
|
|
|
|
|
|
|
|
|
|
发表于 8-9-2009 02:18 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 8-9-2009 02:26 PM
|
显示全部楼层
我 跑 到 。。。  |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 8-9-2009 04:17 PM
|
显示全部楼层
--------------------Configuration: <Default>--------------------
java.lang.NoClassDefFoundError: T10Q4
Caused by: java.lang.ClassNotFoundException: T10Q4
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: T10Q4. Program will exit.
Exception in thread "main"
Process completed.
不好意思 = = |
|
|
|
|
|
|
|
|
|
|
发表于 8-9-2009 04:45 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 8-9-2009 04:50 PM
|
显示全部楼层
问题解决了 但是
我还有一些问题 小弟还是学生 希望senior可以+埋小弟的msn 方便小弟问些问题 
eric3c88@hotmail.com
[ 本帖最后由 卖女孩滴小火柴 于 8-9-2009 04:57 PM 编辑 ] |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|