Hello, I am writing a snipet to see how to make callfromtest2()work, I ran into this runtime error "Exception in thread "main" java.lang.NoSuchMethodError: test2: method <init>(Ltest1 V not found at test1.init(test1.java, Compiled Code) at test1.<init>(test1.java:1) at test1.main(test1.java:14) " Could someone tell me why this code didnt run? Also, where can I get additional explanation on the error msgs from jdk? Thank you. ==============
} void init() { t2=new test2(this); record=new Record(); } void callfromtest2() { if(record.getName()=="Bush") System.out.println("read done"); else System.out.println("ohoh"); } } class test2 { int flag = 1; test1 t1; test2(test1 parent){ t1=parent; method(); } void method(){t1.callfromtest2();} } class Record { String name = "Bush"; int term = 1; String getName(){return name;} }
[This message has been edited by tom nugent (edited March 07, 2001).]
Jyotsna Clarkin
Ranch Hand
Joined: Jan 26, 2001
Posts: 158
posted
0
test10 t10; Here you are declaring a reference t10 of type test10 but your code does NOT contain any such class defintion ?? Where is class test10 defined?? Should that line of code be test1 t10 instead?
tom nugent
Ranch Hand
Joined: Dec 20, 2000
Posts: 32
posted
0
You were right! I forgot to change the name to test1 from test10. Sorry about the confusion. I just re-edited and made corrections to the codes.
Siva Prasad
Ranch Hand
Joined: Feb 22, 2001
Posts: 104
posted
0
Originally posted by tom nugent: You were right! I forgot to change the name to test1 from test10. Sorry about the confusion. I just re-edited and made corrections to the codes.
Hi Tom Still you are getting errors after running this program? You shouldnot!
usman ahmad
Ranch Hand
Joined: Mar 06, 2001
Posts: 46
posted
0
Hi! This piece of code is working fine. i checked with it and it has no problems at all !! it should be the same for you. Regards Usman
tom nugent
Ranch Hand
Joined: Dec 20, 2000
Posts: 32
posted
0
Yes, I still got the errors. This happened even after I re-installed the jdk1.3. My system is window2000. I don't know what's wrong. Any suggestions?
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.