This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Eduardo Ucha

Greenhorn
+ Follow
since Mar 27, 2013
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eduardo Ucha

Thanks so much, it is just the answer that I needed. I understand this situations now better.
1 year ago
I have a doubt because I think that  the precedenceof  x++ is higger of +=. Look at this


It is suposed that += is sustituted by x=x +...


I don't understand why x=1 in the first x in the sum because x++ is executed before because of its precedence, but it isn't. The x++ and ++x take in account the value of x at the moment of the increment.



At the end the value of x is 3 but is overwritten with the value of 8

Well I dont understand why the last x is 2 and the first is 1. if I take in account the precedence the value of the first x at the moment of the sum it would be 3 because the increments of the value in the others operands has been executed but it's not.
1 year ago
Hello,

I have chosen the NoClassDefFoundError, I used the exercise that I had to do a personal exception to do this.
I have a MainClass.java and a MiException.java and I compile it.


javac MiException.java MainClass.java


Before I run the program I do a dir (I am running in windows), and I get:


27/03/2013 09:08 <DIR> .
27/03/2013 09:08 <DIR> ..
27/03/2013 09:08 704 MainClass.class
27/03/2013 09:05 391 MainClass.java
27/03/2013 09:08 372 MiException.class
27/03/2013 08:30 255 MiException.java
4 archivos 1.722 bytes
2 dirs 183.944.970.240 bytes libres


I am going to delete the MiException.class file.


del MiException.class


and then i run the program.


java MainClass


Then i get my exception


Exception in thread "main" java.lang.NoClassDefFoundError: MainClass (wrong name
: com/ocaj/exam/tutorial/MainClass)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)


Thanks for the book.