• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Recursive method with static call

    "Unreachable code" You need to remove the `break`s that come after a `return`, because executing the return means that the `break` that follows it can never be reached. "This method …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Recursive method with static call

    No, the `break` is optional in a switch statement. It's often omitted in code like switch (something) { case 1: case 2: case 3: do something for cases 1, 2 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Event handlers: which event class and which event listener interface

    OK, that's your choice. Personally I would question why anyone would spend time struggling to master the syntax of anonymous inner classes when they just became obsolete (unless they are …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in choose primary value for combobox

    OK. Exacatly how do you want to display the cabinets in the combo box? Give an example.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in choose primary value for combobox

    Can I confirm what you are asking? You have some Cabinets, each with a number and a title. You want to display the title in the GUI, but get the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in get data by scanning image using java code

    Hi Please do not hijack other peoples' old threads. Start a new thread for your question, and give as much information as you can.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Event handlers: which event class and which event listener interface

    Sorry, but yes, the answer *is* in the API doc! Just look for the addXxxListener methods (being alphbetical, they're conveniently near the beginnning of the summary list). Dopn't forget to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in ImageIO problem

    ImageIO is a class that is provided as part of the standard JavaSE installation. You just need to import it, as in inport javax.imageio.ImageIO;
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in printing elements in the arraylist

    For x = 1,2,3 you display 4,6,8 elements. No need for those if tests. You can do that in a single loop if you use a simple formula to covert …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Recursive method with static call

    Yes, static methods are no more thread safe than instance methods - ie not at all unless you synchronise them yourself. I think the question of modifying the parameters may …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in 2d sheet optimization program in Java

    Hi Usman. We get a lot of posts here from people wanting us to do their homework for them, which typically get replies like the above. My guess is tha …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Recursive method with static call

    The pattern here is a recursive method with a number of obscure parameters that are involved in controlling and tracking the recursion. In order to make it easier to use, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How print following structure in java

    Your code increases the number of asterisks by one on each pass of the loop because you are using ++ to add one to the variables that control the number …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java.util.set

    I have no expertise in Hibernate, so I can't answer your latest question, other than to suggest using a List, which will definitely be ordered.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How print following structure in java

    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 Virtual Methods In JAVA

    The Java Language Specification does have "virtual methods" or "virtual functions" These are jargon from another language. If you have a question about C++ this is the wrong forum.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java.util.set

    option #2 is perfectly OK for this purpose. option #1 will also work, but makes it less clear that insertion order is important. No matter how you declare or refer …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Virtual Methods In JAVA

    The Java Language Specification does not have "virtual methods" or "virtual functions" These are jargon from another language. If you have a question about C++ this is the wrong forum.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java.util.set

    No. The order is determined by the precise type of Set that you create, not by how you declare the variable that refers to it. If you don't want to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java.util.set

    In the first case all you are asserting about linksSet is that it is a Set. Anyone using linksSet will only be able to use Set's methods. Maybe later you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in comparing characters

    Ahha! Just seen the significance of those 4 letters. stultuske had the answer: they should be an enum, although there's no need to add the number because enums have a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in comparing characters

    chars in Java are numeric types - they are 16 bit integers that are used to represent characters in unicode. So its pefectly OK to compare them with > or …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Love tester program help

    another solution is to randomly shuffle one or both of the arrays of names. Then you can simply pair up boy[0] with girl[0] etc
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with grade calculation program

    As you can see from the above posts, there's little tolerance here for people who just want someone to their homework. If you want to continue then please explain what …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in testing against a long variable.

    literal numbers like that default to int. For bigger numbers append an "L" to indicate that you want a long value.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with shortest path problem.

    Just 3 cities - you can search all possible paths. TSP is only interesting when you get many cities.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in can someone help condence this code; recursive binary tree

    Yes, if only one is null it will throw an NPE, so it's not the same.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Data cannot be retrieved from a Resultset

    I'm not familiar with DataSet. There's no such class or interface in the JavaSE 8 API. (Was it part of the annotation-based SQL stuff that was in the 1.6 beta …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Data cannot be retrieved from a Resultset

    The next thing to try is a better JDBC driver. That JDBC/ODBC bridge has always had problems, and I believe it's been removed from Java 8. Have you tried the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Data cannot be retrieved from a Resultset

    > I did not unserstand the last quiz. There can be a problem if you have text with Greek, Arabic, Hebrew, or any other letters that are not a-z,A-Z. Java …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Data cannot be retrieved from a Resultset

    A little bit of research reveals that this is a known problem with 64bit OS and less-than-current verisons of Java and the JDBC/ODBC drivers. Are you running 64 bit? Thye …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Data cannot be retrieved from a Resultset

    What do you see when you print rss.getString(2) ?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Data cannot be retrieved from a Resultset

    > rss.getString(1) > Second column of my table is a type of varchar(10) For some perverse reason the ResultSet get methods use indexes that are 1-based, not 0-based, so getString(1) …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Love tester program help

    Was that a joke? If you have a compiler or runtime error message post the complete message plus the actual code it refers to. If your code is giving an …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Love tester program help

    > I've encounted some problems after I run the program You've been around here long enough to know that's useless as problem description! EXACTLY what "problems"? Don't expect us to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in input to Server

    Thats because the code that sends the result is in an if test that's only true for the second input. I would keep references to both ClientThreads somewhere in the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need help please

    It's not hard to test each char to see if it's a numeric or an operator
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in input to Server

    No, it's more like (just a sketch) while(true){ Socket clientSocket = serverSocket.accept(); new ClientThread(clientSocket).start(); } class ClientThread extends Thread { ClientThread(Socket clientSocket) {etc p v run() { PrintWriter out = …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in input to Server

    After your `serverSocket.accept();` you need to start a new thread to handle that connection (pass the Socket object to the construtor of your new thread). Then in that new thread …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need help please

    You're going to need some sort of parser that can separate numbers and operators
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help in understanding and inter-reacting with real devices

    What exactly are the error messages?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need help please

    That's what you probably wan to do, but your code breaks up strings into individual chars, so the 20 gets broken up.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in AVL tree question

    A bizarre answer... 1. This thread has been dead for 3 years, it's a bit late to answer ir. 2. That method doesn't return anything. In fact it has no …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Deathbycaptcha

    Can someone help me with implementing the deathbycaptcha API into Denodo? Thanks
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Threading

    Client-server automatically needs multiple threads. No matter how you do it at the very least you will be waiting for the local user to do something and simultaneouly waiting for …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Stopped Watching multithreading in parallel in java

    I am to create a program which creates multiple threads, has them do work in parallel, and terminates when the last thread is finished, sounds simple right? Here is the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Stopped Watching Html Tag occurence counter

    I am supposed to complete an java assignment which satisfies the following constraints 1)read an .html file which is given as input(This is not an weburl) just an file stored …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding handlers to buttons created with for loop

    Yes, you add the actions in the simple loop, but you need to define all the actions one at a time. I think the idea of the original question was …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Series

    This looks like a case of premature coding. There's no way you will magically come up with the right code if you don't understand the algorithm it implements. The way …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding handlers to buttons created with for loop

    OK! We now have 3 Java 7 solutions to getting the value when a button is clicked, all sensible ideas, but all sharing the same issue that Violet spotted earlier …

The End.