编译期错误:如果用sun公司的源文件,就可以编译;如果是自己新建NOTE就会出现如下面这样的等等编译错误。一直都没搞明白,求各位好心的哥哥姐姐们照顾一下我这个初学都吧!
c:\javapak> javac music5.java
music5.java:6:cannot find symbol
symbol : class string
location: class instrument
public abstract string what();
1 error
源文件:
// A 1d array
import java.util.* ;
abstract class instrument {
int i;
public abstract void play() ;
public string what() {
return "instrument " ;
}
public abstract void adjust() ;
}
class wind extends instrument {
public void play() {
system.out.println( "wind.play() ") ;
}
public string what(){ return "wind " ; }
public void adjust(){}
}
class percussion extends instrument {
public void play() {
system.out.println( "percussion.play() ");
}
public string what() { return "percussion " ; }
public void adjust() {}
}
class stringed extends instrument {
public void play() {
system.out.println( "stringed.play() ") ;
}
public string what() { return "stringed " ;}
public void adjust() {}
}
class brass extends wind {
public void play() {
system.out.println( "brass.play() ") ;
}
public void adjust() {
system.out.println( "brass.adjust() ") ;
}
}
class woodwind extends wind {
public void play() {
system.out.println( "woodwind.play() ") ;
}
public string what() {return "woodwind " ; }
}
public class music4 {
static void tune(instrument i) {
i.play() ;
}
static void tuneall(instrument[] e) {