File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Unexcepted Types... why?" Watch "Unexcepted Types... why?" New topic

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


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 =

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:

I agree. Here's the link:
subject: Unexcepted Types... why?
It's not a secret anymore!