This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The above code compiles fine .But throwing following exception. Exception in thread "main" java.lang.NoClassDefFoundError: threadtest (wrong name: ThreadTest) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:403) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:10 1) at java.net.URLClassLoader.defineClass(URLClassLoader.java:248) at java.net.URLClassLoader.access$1(URLClassLoader.java:216) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:191) at java.lang.ClassLoader.loadClass(ClassLoader.java:280) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:275) at java.lang.ClassLoader.loadClass(ClassLoader.java:237)
I have defined class in filename threadtest.java not ThreadTest.java Can anybody tell what's wrong with this code? Veena
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
Veena, I think you misspelled your class name check the code you pasted Maria
Joined: Jun 20, 2002
I wondered,y my jvm is not printing o/p to me .I had a java file with the name ThreadTest.java......but now I tried again it is working.I didn't do anything.I couldn't know what was the problem...! Veena
Joined: Jun 20, 2002
What priority main thread will have.Coz the above code prints true 1 2 3 4 Shouldn't it print 1 2 3 4 true? Thanks Veena
The default priority of any thread is Thread.NORM_PRIORITY, which is 5. A thread inherits the priority of its parent thread. Both threads here have the same priority, but since the thread scheduler is implementation dependent, the output will be unpredictable.