aspose file tools*
The moose likes Beginning Java and the fly likes Unexcepted Types... why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Unexcepted Types... why?" Watch "Unexcepted Types... why?" New topic
Author

Unexcepted Types... why?

Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 176



Simple prgm. To run it you need an external .txt file called "Init.txt".

What this prgm is meant to do is create separate .txt file for each student. The .txt files should be named according to the ID (which MUST have 4 numbers and range from 1000-9999). When adding, it first needs to search for an available slot starting from 1000.

The problem occurs here: if(temp_file.exists() = false)
I've tested the .exists() method and I know it returns true or false, yet the complier tells me:

unexpected type


why?...


Olly
Vijay Raj
Ranch Hand

Joined: Oct 10, 2005
Posts: 110
You need to check for true or false right, and not assign the value false. So, maybe == will help, rather than just =



Vijay.
Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 176

Oh right... how dum of me

Thanks loads... fixed the problem
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Better way would be:

if(!temp_file.exists())
 
jQuery in Action, 2nd edition
 
subject: Unexcepted Types... why?