This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Scala and the fly likes problem with code.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Scala
Bookmark "problem with code...." Watch "problem with code...." New topic

problem with code....

Pankaj Mittal
Ranch Hand

Joined: Jul 09, 2008
Posts: 32
Hi guys !!

I've got one strange problem....I'm using netbeans 6.5.1 with scala plugin....dunno what the prob is...but sometime this code runs sometime doesn't...

Thanks !!

2008 SCJP(5.0) 88%
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
The problem is mosy likely here:

If you use the equals sign, you have to annotate the return type explicitly as Unit

Alternatively you could omit both the equals sign and the type annotation

Personally I prefer the first form over the second, because I think all top level methods should have their type explicitly annotated. But really it's a matter of preference.

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Pankaj Mittal
Ranch Hand

Joined: Jul 09, 2008
Posts: 32 it !!
It is sorta covered in the JavaRanch Style Guide.
subject: problem with code....
Similar Threads
The fizz buzz coding challenge
Project Euler problems with Scala
Switch Statement
Scala exercises for beginners (in FP)
how to accept an instance of a class as a parameter