• Post Reply Bookmark Topic Watch Topic
  • New Topic

Return Values  RSS feed

 
Timothy Han
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm learning Java by following this guys video (https://www.udemy.com/java-tutorial/learn/v4/t/lecture/138686).  He is covering the topics of "getters and return values".  As I'm going along and following him in this tutorial video he explain and types the code:



Now the output he got from this code is;

My name is: Tim
Years till retirement: 33

How come the output in his console works for him, and not mine?  Now I've checked all my codes and it's spelling, and everything in my code seems to be in order.  I'm not sure why it's not working for me.  He is using Exclipse, and I am using NetBean.  Does our IDE make a difference? 

I ended up getting an error message saying: "Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: getters.and.pkgreturn.values.pkg2.Person.calculateYearsToRetirement at getters.and.pkgreturn.values.pkg2.GettersAndReturnValues2.main(GettersAndReturnValues2.java:35)"
 
Ron McLeod
Bartender
Posts: 1603
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a bracket problem.  The code has the calculateYearsToRetirement method inside of the speak method.
 
Timothy Han
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!