7,116 Posted Topics
Re: From the look of it that printSelf method belongs in the Person class, not the Driver, and it should be an instance method, not static. That's because it's obviously intended to print the details of a current Preson instance. | |
Re: Any reason you have to be on obsolete Java 1.6? The final security update to 1.6 (the one you have) was over a year ago, and you are now missing literally hundreds of fixes, including many "critical" fixes. For your own protection, and the protection of others sharing your network, … | |
Re: Java has no direct support for the Windows registry, but it's easy enough to use `ProcessBuilder` to execute the Windows `reg.exe` command-line utility to perform registry queries or updates. | |
Re: Normally the `throws` and the `try/catch` are in different methods as in void method1() throws Exception { ... if (...) // there's a problem that I can't fix... throw new Exception ("Sorry, it's gone wrong"); } ... } void method2() { ... try { method1(); catch(Exception e) { // I … | |
Re: In Java we would probably use classes rather than 2D arrays here - eg a Ticket class and a Player class. Then you just need simple references or lists (1D arrays). | |
Re: A problem with the first code is that `result` and `to` are declared inside the try block, so those variables cease to exist as soon as the block is exited. You need to declare them outside the try block if you want to use them outside the try block. | |
Re: Never do this when writing new code: } catch (Exception e) { } If/when there is an error you just told Java that you didn't want to know anything about it, and please discard the detailed error message that Java just created for you. ALWAYS put an e.printStackTrace(); in your … | |
Re: 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 this is a genuine question, and not just a homework assignment... can you confirm please? | |
Re: on which line? What value of the index? Post the complete error message. | |
Re: It seems there's a problem with the rules of the game: "only one person can win full housie" and "there may be numbers of winner". That is not a Java programming problem. Only you can decide how to change those rules so they are consistent. Then writing the Java will … | |
Re: That screenshot isn't a stacktrace, and doesn't help. You don't provide the source for your StringUtils class (t's not part of the standard Java API). That leaves us with more questons than answers. You say "everything stops, empty." Do oyu mean the program terminates without any errors? What exactly is … | |
Re: It's saying you have not defined anything called Mailercm Probably you are missing that class's definition, or you are mis-spelling its name. | |
Re: Ahhh - the old BigInteger trick. What you have found is an over-complicated version. The simplest form is just one short line... You can use the simpler version of getBytes without any arguments - that just uses the default char set. If you stick to ASCII characters you'll be OK. … | |
Re: Please be much more specific about your question. We don't know whether you are struggling with how to start a Java program or struggling with some obscure side-effect of using JLayeredPanes in a multi-threaded environment, or any point inbetween. Are you looking at Swing or JavaFX? How much do you … | |
Re: 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 Post what you have done so far and someone will help you from there. | |
Re: What exactly do you want to happen in the user interface (as seen from the user's viewpoint). Eg in round 1 if the dealer makes a bet exactly what do you hope to see happening on the screen? | |
Re: 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, there's a simpler public version without all the extra parameters, that simply calls the recursive method with a suitable set … | |
Re: 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 number when the user has made his selection. Is that right? Are all the titles unique? | |
Re: Hi Please do not hijack other peoples' old threads. Start a new thread for your question, and give as much information as you can. | |
Re: 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; | |
Re: 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 | |
Re: 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 1,2,3 into 4,6,8,,, eg multiply by 2 and add 2. | |
Re: Yes, many people here have done projects in that area. Hoever, 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 Post what you have done so far and someone … | |
Re: 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. | |
Re: 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 you have done so far, why/where you are stuck, and exactly what help you need to make more progress. Then … | |
Re: 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 < operators. Unicode 'a' - 'z' are represented by the numeric values 97-122 respectively, so the comparisons follow normal alphabetic … | |
Re: > 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) retrieves from the first column not the second. > String s=resultSet.GetString(1) > System.out.println(resultSet.GetString(1)) The difference here is that println does … | |
Re: There's a good trick to use here, which is to create a handler that knows which button was pressed - it looks like this: class MyListener implements ActionListener { int buttonNumber; public MyListener(int b) { // constructor takes button number buttonNumber = b; } public void ActionPerformed(.... System.out.println("Handling event for … | |
Re: > 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 guess! | |
Re: What exactly are the error messages? | |
Re: Yes, if only one is null it will throw an NPE, so it's not the same. | |
Re: Just 3 cities - you can search all possible paths. TSP is only interesting when you get many cities. | |
Re: literal numbers like that default to int. For bigger numbers append an "L" to indicate that you want a long value. | |
Re: 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 open the input & output streams etc. You main thread then loops back to the `accept` and waits for user2 … | |
Re: I can't see any problems in that code. Are you *certain* that the nodes are being populated correctly with the names and links? | |
Re: 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 output of any sort at all. It's completely useless. | |
Re: 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 the other user to do something. If you want to extract maximum learning from this I'd set it up as … | |
Re: 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 helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) … | |
Re: Yes, you can use `double` variables if there are decimal places in the data. | |
Re: That sounds like a homework question that you want someone to answer for you? | |
Re: Do not ask for help to pursue any illegal activity including, but not limited to, hacking and spamming Thread closed. | |
Re: The error shows your classes and manifest are ok. It looks like you failed to package your png files in the jar properly - the message implies it can't find them. | |
Re: Read the inage file into an `ImageIcon` and set that in a `JLabel` | |
Re: Static methods execute without an assocated instance of the class, so they don't have any direct access to any instance variables or instance methods. They only have direct access to static variables and static methods. It's nothing to do with get/set as such. | |
Re: ^ ... provided they are declared as being in the same package. If you use (multiple) packages then you need a directory hierarchy that matches the package hierarchy. ps: It really has to work that way, just consider two classes each of which references the other. | |
Re: Separating words and hints is a forumla for update chaos. Just read the file 1 line at a time. Get the index of the first " " and use that to substring the word and the rest of the line (the hint). Store them in 2 ArrayLists (or create a … | |
Re: rmic? That has been obsolete for ten years (well, over nine and a half anyway). It was made unneccessary in Java 1.5 (Sept 2004). See http://docs.oracle.com/javase/tutorial/rmi/overview.html Don't waste any more time trying to fix an rmic error - update to the current simpler approach as detailed in that tutorial. | |
Re: Not 100%. "Primitive" types (int, boolean, char , float etc) are not objects. | |
Re: The quickest thing to do would have been to print strName just before the if test, which would have revealed the problem without waiting for a DaniWeb response. But anyway... That code fragment seems a bit scrambled, but it looks like you have a scanner problem. I hate Scanner. A … | |
Re: System.out.print(" " +num+ "is in index " + array[i]); You are printing the *value* in array[i], not the *index*. |
The End.