Hi guys
I've just started Java and I don't know much and do not have much experience either. Anyway, I was practising, and I wrote the following script:
My file was named example.javaCode:class printstr{
void printstr(String var) {
System.out.println("String argument: " + var);
}
}
class example{
public static void main(String args[]) {
printstr obj1 = new printstr("example string");
}
}
Somehow my java compiler gave an error saying:
Initially I thought there was something wrong with my code. So I copied some code from the book I was learning java from which contained the keyword new, and my javac gave the same error.Code:C:\java>javac say.java
example.java:9: cannot find symbol
symbol : constructor printstr(java.lang.String)
location: class printstr
printstr obj1 = new printstr("example string");
^
1 error
Is there something wrong with my compiler? I have the latest version of it - JDK SE 6 Update 17. Or is java2 too old or someting, because I'm learning Java2..
Please help!
