• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in LibraryBookSort

    That line is OK, but you have an error on lines 11 and 18 where the capitalisation of the variable name is different. It's pointless trying to run a program …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in GUI Java program to convert temperatures from Fahrenheit to Celsius and f

    Is it wrong? In what way? Do you have an error message? Does it goive the wrong results? You must tell us everything you know if you want help.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java is not purely oops language,if its true then why?

    Primitives like int, char, float, boolean are not Objects, so the language is not 100% OO. The reason was for efficiency and speed - primitives have much lower overheads than …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Searching Sub Directories for File

    ... or here's a even simpler one - it searches for a given file name anywhere in the directory tree... class MySimpleFileFinder extends SimpleFileVisitor<Path> { String target; public MySimpleFileFinder(String target) …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Inventory Part 6

    Exactly the same reason, exactly the same fix. If you want a \ in your Regex then you have to code two \ chars in the Java String literal, because …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Searching Sub Directories for File

    This is a public forum for everyone to contribute and everyone to benefit - so no PMs. Here's a simple eg that adds up the total size of a dir …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Searching Sub Directories for File

    Yup. http://docs.oracle.com/javase/tutorial/essential/io/walk.html (that tutorial seems to me a bit intimidating at first, but when you try it it's really simple. I have a couple of demo classes for it if …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Searching Sub Directories for File

    Recursion is the answer if you want to hand-code this. The basic structure goes like (pseudo code): method searchDir(Dir d) { for each File f in d if f is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with compiler implementation - phase 1

    Can you explain something for me please? I thought the transition table for a DFA looks somnething like table[current state][next token] = next state so conceptually I'd expect to see …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find all possible paths from source to destination

    Good point about cycles Hiroshe. When talking about DFS searched being exhaustive and terminating I should have mentioned the need to reject solutions that re-visit a node that has already …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Checking Occurrence in a String

    (because chars are integer numeric values you can simply use them to index into an array of counts - in which case that algorithm is as efficient as you will …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Picture Slideshow in Java

    What have you got so far?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find all possible paths from source to destination

    A nornal BFS will cover all the routes in a logical order until it has covered them all, won't it?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Search algorithm

    DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find all possible paths from source to destination

    There's two parts to this: Easy: When doing the DFS and you find a path, instead of stopping just add the path to an ArrayList and keep going. The DFS …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to know when a thread ends.

    DaniWeb Member Rules (which you agreed to when you signed up) include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in compiler

    There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in AES Encryption Logic

    DaniWeb Member Rules (which you agreed to when you signed up) include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java projects for learners

    Nice contribution Slavi. The one you referred to uses a GUI with ten number buttons, and is a very good choice for an early Swing project. (There's not much point …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Linkedlist program doesn't work

    That's a lot of code, but you still haven't told us what your question/problem is, and that code is still incomplete (no Link class). So what are you asking us …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Doubt in for each

    > I want to construct an Employee class and solve the error. Before you get bogged down in Java syntax, think about the meaning of what you are trying to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in User Input With Scanner In Java

    PrintStream ob=new PrintStream(System.out); ob.print("Hello World"); Good point stultuske System.out is a PrintStream, so `new PrintStream(System.out)` just creates another PrintStream object which is just the same oas the original. SO there's …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Object Creation of String Class

    Because you want to make many Strings in a normal program, Java has special syntax to make it easy, eg. String name = "Joe"; without that you would have to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in User Input With Scanner In Java

    n=input.nextInt(); works because `input` is a Scanner n=System.in.nextInt(); does not work because `System.in` is NOT a Scanner
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in PRG 420 Individual Assignment - I need help 2

    int amount = scan.nextInt(); String[] name = new String[amount]; String[] secondname = new String[amount]; Yes, that's perfectly valid sensible code.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in User Input With Scanner In Java

    Line 8 is wrong. There is no `nextInt` method in System.in You must create a Scanner using System.in (just like your previous post) Then you can use the Scanner's nextInt …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Combination Lock

    No need for the counter - it's just another thing that could go wrong. You can use the length of the bld String and see if that is 3. Don't …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in creating sentences

    There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Combination Lock

    Like mKorbel says: You can't do this with a 1..3 loop. Each time a button is pressed append it to the combination String. When that results in a String of …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Combination Lock

    That looks 100% better - you're really on the right track now. It's especially good that you stopped there and added a line to allow you to test what you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in IS THERE REALLY ANY USE OF INTERFACE?

    An interface defines a set of methods that must be implemented by any class that implements the interface. Eg You could define an interface with a calculateArea method. Then define …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to wait until another form closes?

    Just have a method that re-enables the components, and call that as part of whever listener is handling the close of the other window.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in What Is ".in" in system.in

    `in` is a public constant in the System class. It refers to an InputStream object that gets the input from the console. Here's part of the API doc for the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in convert date to MSExcel format?

    "getting an error with it"? That's not helpful. Exactly what error where?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Combination Lock

    Everything to do with Swing (eg painting the screen, running actionPerformed methods) happens on a single thread - the "Event Dispatch Thread", or "EDT", or "Swing thread". Your actionPerformed is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in While loop

    OK! One small point - rather than just print "error" when you get an exception, it's a good idea to execute an ` e.printStackTrace();` so you will see all the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in While loop

    There's an alarm bell ringing over this line... program.run(); You (almost) never call `run()` directly in Java. The `Runnable` interface is intended for use with Threads - ie you instantiate …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in convert date to MSExcel format?

    Use / as a delimiter for your Scanner
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help! Java Newbie

    Even after you fix that... When your method reaches the return statement it will immediatley return to the caller, and any remaining statements will not be executed. That's what your …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How pass to the string value to another class

    You declare `String test` on line 9 of a. When you declare a variable in Java its scope if from the preceeding '{' to the following '}'. In this case …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Client GUI

    You can have 2 classes in one file - only one can be public but you can have as many others as you want. If you want to create one …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Client GUI

    Well, it's not strictly necessary, but my opinion is that in the end it will be the easiest way. It's also good practice to separate GUI from the underlying functionality, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Client GUI

    A good start would be to separate the GUI code from the newtworking code. Refactor it into two classes so you can create and swap a new instance of the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in remove -1,-1 in smoosh method

    In your `stringInts(int[] ints)` method, test if each value is -1. Only add it to the output String if it is not -1.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Syntax Error on showOpenDialog

    You didn't post the declaration of testgui, but apparently it's not a subclass of Component. The ".this" is even more mysterious.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with only allowing user to enter integers at a certain point

    Yes, I agree. Scanners are supoposed to be easy, but in reality seem to cause a lot of problems. If you use a BufferedReader, and readLine() to read whole lines …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Linkedlist program doesn't work

    Where's the definition of the Node class?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How would I go on about this (Reading from file)

    Write the count variable to a `PrintSream` - that will write it as a String that you can check by opening the file in any text editor. Read it back …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to get the detail stored in description column of ACCESS table using Ja

    > @JamesCherrill I already got the name of fields like ID and Name also I am able to get the data type like autonumber and Text but how to get …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to get the detail stored in description column of ACCESS table using Ja

    Have you tried getColumnLabel instead of getColumn Name ?

The End.