|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
Find the error
Code:
import java.io.File;
public class DetermineFileDirExists {
private static void doTest() {
// Create a File object
File file1 = new File("README_InputFile.txt");
File file2 = new File("BlaBlaBla.txt");
boolean b = file1.exists();
System.out.println();
System.out.println("Does File/Di " + file1 + " exist? (" + b + ")\n");
b = file2.exists();
System.out.println();
System.out.println("Does File/Di " + file2 + " exist? (" + b + ")\n");
}
/**
* Sole entry point to the class and application.
* @param args Array of String arguments.
*/
public static void main(String[] args) {
doTest();
}
}
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Company Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall ![]() ![]() |
| Sponsored Links |
|
|
|
|||||
|
Find the error in the coding.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Company Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall ![]() ![]() |
|
|||||
|
I'd have to look at a reference, but it looks like you've got a timebomb waiting for you if file1 or file2 does NOT exist. file1 and file2 are not the filenames.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
|
|||
|
Erm, I looked through this, and there is none...
[edit] Proof of concept, I even compiled and ran it, works fine. Haha.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
| Sponsored Links |
|
|
|
|||||
|
Quote:
it is suposed to be pointed to /Dir Meaning Directory
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Company Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall ![]() ![]() |
|
|||||
|
Hmm, that is a little hard to guess. How do we know that the creator didn't have a /Di directory?
![]()
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages! |
|
|||||
|
thats what i have been saying that I don't really like this example.
Closed. Make a new one.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Company Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall ![]() ![]() |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| questions about java games | stack | Java Help | 3 | 07-02-2007 06:35 PM |
| MS-SQL deadlock and hang the Java application | reachpradeep | Database & Database Programming | 1 | 03-11-2007 05:20 AM |
| Java Facts | techni68 | Java Help | 0 | 01-17-2007 02:41 PM |
| John's Java Tutorial Index | John | Java Tutorials | 0 | 01-11-2007 04:05 PM |
| Java Help Files | xXHalfSliceXx | Java Help | 3 | 11-29-2006 12:30 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |