File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unexcepted Types... why?

 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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?...
 
Vijay Raj
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 176
Chrome Mac Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh right... how dum of me

Thanks loads... fixed the problem
 
ankur rathi
Ranch Hand
Posts: 3830
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better way would be:

if(!temp_file.exists())
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic