Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Temperature converter error  RSS feed

 
Kristoffer Van Strijdonck
Greenhorn
Posts: 9
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a problem finding out exactly what's wrong with my code. Here are my classes. (Don't pay attention to the name of my main class, I know it's wrong)

Main class:





My 2 other classes:



And






My problem: My IDE says this code is wrong (it underlines "FahrenheitToCelsius"):

I don't know why this code is wrong. Can anyone help me? Thanks in advance.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37230
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

The compiler can't find that class. Most of your code is in the package "javacurrencyconverter;" FahrenheitToCelsius is not. It is in something called the "default package" because you've accidentally omitted the package line. Since you can't import the default package, the only code that can refer to would also have to be in the default package.

As you might imagine, the best fix is to add the missing package statement.
 
Kristoffer Van Strijdonck
Greenhorn
Posts: 9
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fixed it. Thank you, Jeanne.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!