7,116 Posted Topics
Re: You're on the right lines, but have a closer look at 14: rightDigit = max; and you use max as both the input parameter and as a working variable inside the method this is never a good idea. Much better to have 2 distinct variables. That will help avoid confusion … | |
![]() | Re: stultuske may not be the most diplomatic person here, but his message is right... 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: Java Sockets? http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html | |
Re: function12 throws an Exception, but you never catch or throw it upwards when you call that method | |
Re: The definitive Oracle tutorials are kept up to date, and include MySQL... http://docs.oracle.com/javase/tutorial/jdbc/index.html AFAIK there were no significant SQL-related changes in JDK 8. | |
Re: It means the method is a class method as opposed to an instance method. You do not need an instance of the class to use that method, and the method has no access to any instance variables or instance methods )unless someone else supplies the instance). | |
Re: It's a TV game show. [WikiPedia has the details](http://en.wikipedia.org/wiki/Deal_or_No_Deal_(U.S._game_show)) ps If ever a piece of code needed to use arrays, it's this one! ![]() | |
Re: Yes, people here will help you to write your Java code. What help do you need exactly? (But be aware that "help you" does not mean "do it for you".) | |
Re: An array of chars is one thing, a String is a differemt thing. Arrays of chars are not very often used - all you can do is iterate through the array to process the chars one at a time Strings are used all the time - they have dozens of … | |
Re: I can't comment on the C++, but as an OO design it seems to confuse two different objects. You have a Person type (calling it "Record" is just unhelpful). Each Person has a name etc, and methods for accessing its attributes. But then you have addRecord, search etc which make … | |
Re: Line 60: shouldn't you be adding the costs, not the sizes? | |
Re: ^ like stultuske says. But anyway - looks like problems with the constructors. When you create a subclass like that you typically need a constructor that has all the values needed for the superclass, plus the xtra ones needed for the subclass. Eg (pseudo-code) class A { variables a.b.c constructor … | |
Re: That's still a useless description of your problem. But anyway - if you were to add an action listener to that button it may help. | |
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: There's nothing wrong with 9...9 as a large int, but `Integer.MAX_VALUE` is the largest possible int, and nicely self-documenting. | |
Re: It won't work in java any better than it will in C++. tenths and hundredths can't be represented exactly in a binary floating point representation, so this naive approach will always suffer from the risk of rounding or truncation errors. | |
Re: The API doc includes example code. The Oracle tutorials cover this as well. Yes, it works in a program | |
Re: Did someone speak my Name? Yes, except a JTable in the middle, not a hand made grid. I don't know if you can do that with the print methods in JTable. I suspect you will have to use the normal printer support and draw your header &footer as part of … | |
Re: You could: 1. Have each thread synchronise its file I/O using the File object as the lock. This is simple, but may block the client/server connections for too long. 2. As each client sends it data, append that data to an in-memory queue (one queue for each file), then have … | |
Re: This makes no sense. Please try to explain properly. | |
Re: You will also have to setOpaque(false) on the individual panels etc in your tabbed pane. | |
Re: Ok guys, let's keep this friendly please. | |
Re: I'm not a C<anything> enthusiast, but this sounds like a generic architecture question, and here's the standard generic answer. Normally you would have a "game" class that contains (or knows about) all of the data and state information for your game. It has no user interface, but does have public … | |
Re: No time now to read the code, but... the message is clear - you have used double where an int is required. The compiler won't allow an automatic conversion because doubles can have fractional values but ints can't. | |
Re: Lines 16 & 18 generate two numbers, but you have only one variable to strore them, so the second one overwrites the first. So You need at least two variables for the two random numbers, then you can use those to display the question (like line 20). Once you have … | |
Re: It looks like inputChar is supposed to be a `char` that the user inputs? That's not a class that you need to define. It's just like the `int` and `String` variables that you have already defined and read from the user. | |
Re: while (!signalFromThreadB) { pthread_yield(); } Isn't that a flat-out polling loop that's going to burn 100% of the spare CPU time? Safe, maybe, but not good practice? | |
Re: Before reading all that code... How much of the requirement is working already? How much is implemented, but not working properly (detail incorrect behaviour vs correct). How much isn't implemented at all? | |
![]() | Re: Honestly now... if we are to give appropriate help then we need to know did you write that yourself from scratch, or did you copy from some web site? What's strange is that you have code written for an old version of Java. |
Re: When someone runs your program from the command prompt (or batch file etc) they can add parameters to their command. You get a copy of those parameters in the String array. java.lang.* is imported by default in all Java programs | |
![]() | Re: Any code you find here is probably as simple as it can be to do the job. It may not be easy, but real programming is never easy. Just make a start and try to code it yourself. You won't learn much by just copy/pasting someone else's code anyway. When … |
Re: Here's the secret. ActionCommand defaults to the button's text but only if you ask the button itself. An explicit ActionCommand is actually stored in the Model but if you query the model there's no default value there. `group.getSelection()` returns the model, so doesn't see the default ActionCommand, only an explicit … | |
Re: It's a real problem with Scanner's design - so many people fall into this trap. You have some input with an int followed by some text, eg 101 John Doe ... and you try to read it with int num = scanner.nextInt(); String name = scanner.nextLine(); ... and name is … | |
Re: Depending on your video file formats (mp4 is good), Java has built-in capabilities for playing video files directly in its own GUI - no need to install/interface with an external video player. http://docs.oracle.com/javase/8/javafx/media-tutorial/overview.htm#JFXMD101 (But if you want to support the meximum possible range of file dormats, VLC is the most … | |
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 the | |
Re: Key questions: Do you have the skills to create a commercial software product? Do you have an idea as to what the product should be? If so, develop it and distribute it through the MS/Android/Apple store(s). Do you have demonstrable specific sales skills that would encourage a software developer to … | |
Re: What EXACTLY is the error message? ps: reading a double, then assigning it to a float is a compile-time error becuase float is a "narrower" type than double - information will be lost on that conversion - but that's not a run-time error | |
Re: I experimented with Yosemite in a VM on a fairly ordinary Core 2 machine (but with 8 Gig RAM - essential) amd performance wasn't noticably different from a 4Gig Mac Mini with a similar processor. With an SSD it was faster than a Mac Mini. (You should get advice on … | |
Re: Use a JFormattedTextField. See http://docs.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html | |
[This article](http://lifehacker.com/the-top-programming-languages-ranked-by-job-demand-po-1601752302) will give you at least one good reason... | |
Re: Do you just want to close a JTable inside a window that stays open, or do you want to close/free a whole winodw, including the JTable that's in it? | |
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: You use it whenever you want to send an instance of a class to another system (eg server to client) | |
Re: Your pocket class will hold a number of coins, so it will have to have some kind of Collection as an instance variable to hold all the instances of Coin. Yes, you could use an array `Coin[]`, or an `ArrayList<Coin>`, but before chosing think through all the ways you will … | |
Re: If the code you posted looks OK, maybe there's a problem with the contents of tempq? | |
![]() | Re: It dates back to 1968 when Dijstraka published his famous ["Goto considered harmful"](http://www.cs.utexas.edu/users/EWD/ewd02xx/EWD215.PDF) letter in the Communications of the ACM. Until then goto was considered a normal essential part of any language. I was working in IBM's software products division in 1969, and headed a project to re-write our coding … |
Re: Fortunately the whole of "standard" Java is defined in just two documents - the Java Language Specification and the API JavaDoc. Oracle also maintain a detailed tutorial site that covers the vast majority of the language and SE API. If you work through the whole tutorial site you'll know more … | |
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: What do you need to know about - all the hardware, or just the presence of a standard input device (keyboard) and/or a screen? |
The End.