• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Thread is never ending after it owns the object lock

    I don't know what your overall intention is for how this code should execute, but 1. You have a single block of code synchronised on a single instance of Animal. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need some help with SwingWorker

    1. To prevent the application for terminating when yuo close the window, use WindowConstants.DISPOSE_ON_CLOSE (releases all the window's resources, leaves the program running) or WindowConstants.HIDE_ON_CLOSE (just makes the window invisible). …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java Project Ideas and Suggestions

    Yes. There's nothing Java-specific about any of this. The fact is that the programming forums are organised by language, and topics need to be posted where they will be seen. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need Java Help

    The Java language shouldn't cause you any problems at all (apart from some stuff around generics maybe) - it's just C++ for people with more than 16k RAM and no …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java Project Ideas and Suggestions

    Please note that there is a stick thread for exactly this - it's the first topic in the Java forum http://www.daniweb.com/software-development/java/threads/430542/java-projects-for-learners your additions to that thread will be very welcome.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need some help with SwingWorker

    You coded `54. setDefaultCloseOperation(EXIT_ON_CLOSE);` and Java is doing what you told it! That option instructs Java to exit the whole program when the JFrame is closed. I realise that you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java examples - open source high quality code ?

    Honestly? I think you may be over ambitious. Any one of those topics includes a huge base of data and practice - just take them one at a time and …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Core Java Tutorial Point

    This looks like homework. What do *you* think the answers are?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java examples - open source high quality code ?

    Yes, Eclipse is trhe other. I can't comment on the quality of either sources because I haven't read them myself. I would expect them both to be of very high …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in when to use paper book and when ebook?

    ckide seems to work in C++ and Java, so either forum would be a reasonable place to ask. It's certainly NOT an error that would justify any moderator action.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Different Overloaded methods are choosen for the same Value.

    The answer. as always, is in the doc, the Java Language Spec in this case. Section 15.12.2.5. > 15.12.2.5 Choosing the Most Specific Method > If more than one member …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java examples - open source high quality code ?

    The usual GUI lib for Java is its javax.swing - part of the standard Java API. However, starting with Java 8 this month Oracle are pushing JavaFX as a superior …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in when to use paper book and when ebook?

    ^ +1 to all those, plus they are more likely to be up-to-date
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to call enum string in field, resort array

    Look at the Enum.valueOf method - it gives you the enum value from a String. Eg you pass it the String "May" and it it returns the enum value Average.May
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Video chatting application in java

    Don't you think that the point of your project is to do it yourself? Nobody here will help you cheat.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in changing background

    Thyat's an OS function. In windows right click the desktop and select "personalise".
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in changing background

    Change the background of what? Please give more detail of your requirement.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in question I am having difficulies with help pls

    There's a mistake you make on lines 17, 45, 49 and 54. You try to change the value of a parameter in a method. That's perfectly legal Java, but it …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cannot print the decimal places with double

    What you did was a standard way of doing this. Personally I prefer this pattern, which has only one read of user input while (true) { get user input if …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Understanding How Java Works

    The kind of bracket is important, [] is not the same as {} The number in [] defines the size of a new array... new int[7] is a new array …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java examples - open source high quality code ?

    I didn't say "read the API", I suggested you read the source code of the Java classes that implement the API. That satisfies everything in your first post except the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java examples - open source high quality code ?

    The source code of the entire Java API can be downloaded form Oracle. That's as high-quality as anything gets.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Best Language for BigData/Hadoop Java or Python

    This one of those "which is best, football or cricket?" kind of questions. People are going to disagree strongly, mopstly based on personal preference and bias. To get things started: …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to close the window

    To close a JFrame and release all its resources you can call its `dispose()` method.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in arrays in java

    Like I said before, Average.values() is an array of enum values, it's a loop along this pattern (pseudo code): for i = 0 ... 11 { print actual[i] print Average.values[i].getAverage() …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question about ObjectOutputStream/Multiple Clients

    Sockets give you raw InputStream and OutputStream on which you can then layer any other higher-level stream eg PrintWriter. However, Object streams work perfectly well over sockets, and have the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in arrays in java

    That doesn't fix the error - you have 12 data elements so the array should be [12]. What you did just "hid" the error. Your problem comes down to this: …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in TSP: creating an initial population of tours

    Your code is heading in the right direction. You need to: 1. create an array with each city once: 1,2,3,4,5 2. shuffle it randomly 3. copy whatever is the first …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question about ObjectOutputStream/Multiple Clients

    :) But seriously.. what *was* the cause of the problem?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in arrays in java

    After the for loop (Lines 34-38) i will be >= CurrentMonth.length, so that's why you have the error - array index out of bounds on line 45
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How do you use a custom print method to display results?

    All you need the loop for is to count up to eight. Inside the loop you just need to create a new pancake and add it to the stack. The …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to mix bill notes

    Obviously you were able to work out that 1500 can use 7 200's, then that the remainer was 100, which is one 100 note, so just code the method/formula you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How do you use a custom print method to display results?

    That's a very specific homework question, and the answer is one very short line of code. You should make a greater effort to solve it yourself, rather than ask us …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How do you use a custom print method to display results?

    create an instance of the class Stack<String>, let's suppose it's called "theStack", then just pass that to the print method: print(theStack);
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Printer

    ... but seriously, can you explain in more detail what you need? The brief sentence you posted didn't seems to make any sense.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java book

    +1 for the Oracle doc, especially the tutorials. The other problem with books is that they get out of date. Remember there is a HUGE update to the Java language …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to mix bill notes

    One simple way is the use as many 200 as possible, then as many as 100 etc until what's left can be done in 10s. If you get this version …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in TSP: creating an initial population of tours

    That really is a whole lot better. So now what exactly is the problem or question? ps: Edit button behaviour is standard - you only have limited time to edit …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question about ObjectOutputStream/Multiple Clients

    Nobody here is going to be stupid enough to waste any time trying to debug a program that discards and ignores relevant Exceptions. Given the problem you have described, your …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hashtable help

    > 40: buckets = new Entry[defaultSize]; You just did!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hashtable help

    Yes, that's OK. The <K> and <V> types are defined for the HashTable class, so they are automatically available and usable in any inner class of HashTable. There's no need …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hashtable help

    Why not look atthe API doc for java.util.HashTable and its inner HashTable.Entry class. That will give you a good idea of what the public parts of a typical implementation look …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in eclipse taking too long to open

    Can I suggest a little sensitivity on this topic? We know nothing of the OP's circumstances, and we do not want to cause offense or upset.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in eclipse taking too long to open

    It's a dual core Pentium (!)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java file handling-converting currently modified file to diferent format

    > Do anyone have idea how to execute batch command in java. http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Extending a class that extends a class and implements an interface

    <Order extends Queue<Order>> looks wrong (?) How can Order be a subclass of Queue<Order> ?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Govind_1 in How to check NULL character in an array

    you can use the following.. '\u0020' it works..:)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cannot print the decimal places with double

    In my opinion it's reasonably good code. So although there are quite a few points raised in this post, don't be discouraged. The variables names are very clear, so it …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cannot print the decimal places with double

    miles_per_gallon = miles / gallons; Because miles and gallons are both ints this division is done in int arithmetic. After that, the result is converted to double to match the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in not accurate

    Line 10 you calculate Math.pow(x, i); but you don't do anything with the result.

The End.