713 Posted Topics
Re: You're defining functionality. What is it that needs to happen? High-level, it looks like you want a player to take a chair at a table. Okay, is that something that a player does, or something that a player does? I think it's something a player does, so it's in player. … | |
Re: He might have just been hanging around waiting for an answer all this time... | |
Re: Here's one problem: [CODE]if (!name.equalsIgnoreCase("stop")){[/CODE] What happens if this branch doesn't fire? What happens if I enter "stop"? Now, I don't know which is the line 63 that you mean - I can't see any reason why the line numbered 63 here:[CODE] System.out.println("Employee weekly salary: "+nf.format(employeeWeeklySalary));[/CODE] wouldn't execute. But I … | |
Re: The best way to help someone who's got a bug in their code is to show them how to look at their own code and see the error. Showing them error-free code allows them to skip the step of finding it, and that aha! moment is what brings the real … | |
Re: Provide reason why I should do your homework for you. What if you are trying to learn java? How will you learn java if you don't do your own homework? What if the information is readily available in the extensive documentation provided by Sun? Provide examples. | |
Re: [QUOTE=solomon_13000;1566425]Therefore when comparing a wrapper object other than Boolean using the "==" symbol it's value has to be between 0 to 255. Otherwise it will throw a false value. Am I correct?.[/QUOTE] No, not really. This may be a rule of thumb that works some of the time, but it's … | |
Re: Why are the errors buried in the code like that? To the OP: the value on the left hand side of the = sign must be a variable - a single variable, not an arithmetic expression or a method call or anything else. It's not an equal sign like in … | |
Re: This sounds like a lisp-type problem. Have you considered clojure? | |
Re: [QUOTE]whether or not java is object oriented, depends on how you write your code.[/QUOTE] Agree also. The more I write, the more I see how true this is. In some ways, Java starts to seem like two languages to me - an object composition language married to an object manipulation … | |
Re: If you're going into the wheel-building business, it makes sense to invent some wheels. If that means re-inventing them, so be it. And besides, re-inventing the engine seems like a good idea. Car companies do it all the time... If you just want a wheel for your wagon or an … | |
Re: I don't see any problem with posting a pointer to useful reference materials. | |
Re: [QUOTE]A warning to terrorists around the world: we will find you and kill you because now "there's an app for that." [/QUOTE] Is it just me, or is this post extremely distasteful? Not to be glad the world is rid of bin Laden - I for one take no great … | |
Re: Strictly speaking, that clause has nothing to do with deleting an account. You're talking about maintaining records of your transactions with members. That's reasonable - you don't delete from the database, you mark something as deleted. But that doesn't mean you can't delete an account - you just have to … | |
Re: [QUOTE]For languages without a dedicated forum, the Legacy and Other Languages forum is there as a catch-all. [/QUOTE] There's also mobile development. [QUOTE] I prefer not to have additional deeper levels because they tend to be ignored/unseen.[/QUOTE] Yes, or they become a hangout for the three people who wanted that … | |
Re: It's a common problem with on-line "communities". The effect is actually similar to playing a slot machine - each act of checking in is a small invesment on its own (I'll just read this one follow-up, or respond to this one thread = I'll just put in another quarter) but … ![]() | |
Re: [QUOTE=]However, I do need to begin by first training him, so it will probably have the opposite effect at first.[/QUOTE] Brooks' Law has not yet been repealed. | |
Re: [QUOTE]i learn best by doing so i will be glad if u can add example codes to it[/QUOTE] If you learn best by doing, do. sirlink's advice is good: solve the problem for a specific case, say (1,1) and (4,4). Then solve for (x1, y1) and (x2, y2). Also, it's … | |
Re: Speaking of learning java: Methods either return a value, or they don't. A method whose return type is "void" doesn't return a value, a method with any other return type does return a value, and the value will be of that type. [CODE]public int foo() {}[/CODE] must return an int … | |
Re: If you're using the word "fatal" with regard to collisions, a hash might not be your best option. If you need to generate a unique ID, generate a unique ID. | |
Re: [QUOTE] Now I don't miss them at all, and have saved over $65,500 figuring today's prices ($6.00 per pack), or enough to buy me two new cars or a new house.[/QUOTE] Where are you living that a house goes for $65K? There's a two-bedroom condo down the street from me, … | |
Re: [QUOTE]I expected the program to update the original array but it seems to update the array that has been sorted. i tried to copy array but it does not seem to help me. how do i make sure sure that the array that is updated is the original array. Desired … | |
Re: It seems to me that we're missing the point somewhat. If-chains are best when they're refactored out of your code, and switches likewise should be mercilessly eliminated whenever possible. Reflection gets you somewhere, (and James, I'm playing with some ideas to make this even easier - I haven't left the … | |
Re: Or, perhaps more elegantly, you could use a collection of some sort (an ArrayList, most likely) to store words of the currently longest length. So now there are three cases: less than max, longer than max, and equal to max. The first is going to remain the same. What do … | |
Re: This is just a guess, but I'm thinking your input String still has the carriage return or other whitespace, and so it's not equal to the comparison string ("bye\n"!="bye") instead of this [CODE]if (operation.equalsIgnoreCase("bye")){[/CODE] try [CODE]if (operation.trim().equalsIgnoreCase("bye")){[/CODE] And see if that works. | |
Re: Yes, that's what readLine is. It reads a line, a line being marked by a newline character, which is what you send when you hit enter. (I presume that r is a BufferedReader - please provide these details next time, so the people who want to help you don't have … | |
Re: [QUOTE=nssltd;1547974]I Agree whole heartedly massive event ;) Executed so well..[/QUOTE] They had executions? And I missed it? And here I thought it was just going to be a bunch of inbred toffs wandering around looking pleased with themselves... | |
Re: Funny, I was just reading Jon Bentley's article about Tony Hoare's algorithm for generating N random values from 1 to M. It's in the second volume of "Programming Pearls", which has some really good stuff if you're willing to read about old-school stuff. (Most of his examples are written in … | |
Re: You've got a real design problem here, in the form of count. Count is a global, but clearly it's intended to represent the number of items in the sublist passed in as a parameter. What happens if I call this method with a list as a parameter, and that list … | |
Re: I have no idea whether your line numbering agrees with the numbering assigned by Daniweb, so I won't try to look at line 222 of the source here (though it's possible that it's the problem line) Here's a procedure for fixing this sort of thing: Open up your editor of … | |
Re: "System.out.println(hm.get(new Friends("Draumer")));" You haven't overridden the HashCode method, which is what the HashMap uses to hash the objects. Since you haven't overridden it, it's using the default which I think is calculated from the object's address in memory. If you want this object's identity to be based on name, you … | |
Re: This is one of those times when I wish that functions were first-class citizens in Java. I'd really like to just stick those method calls into a hash table right about now. Unfortunately, you'd have to set up a class to encapsulate that funtionality, and managing all of those Command … | |
Re: Look [URL="http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html"]here[/URL] first. | |
Re: [QUOTE]e.g. in the code fragment int i; i+=2; here i gets the default int value 0 [/QUOTE] Um, no it doesn't. Not unless it's a field. [QUOTE] int i,j; for(j=100;i<j;j--){i+=2;} [/QUOTE] This won't compile, either. Did you try these before you posted this? [QUOTE]What is the sound of one hand … | |
Re: Okay, I'm replying as soon as possible. My reply is to say that I, for one, am not taking your exam for you. Good luck, though. | |
Re: [QUOTE=Ancient Dragon;1554456]You will have to do something knightly -- like slay a dragon or something. Or an entertainer, like comedian Bob Hope.[/QUOTE] Or reach the eighth rank without being captured - though that wouldn't get you to king. You could be a queen, though. I know people who get to … | |
Re: Maybe it's your ASCII art, but that doesn't look like a heap from where I'm sitting. 100 can't be both a child of 1 and a parent of 3. By the heap property, if the node containing the max element of the tree is not the root, then that node … | |
Re: What's the error it's reporting? I can make some guesses, but it's a lot easier if I know what the problem is... | |
Re: Why not just start from the first of the month? If we continue to ignore holidays (or handle them as special cases) there are three possible cases: Saturday, Sunday, or other. If the first of the month is Saturday, 1st working day is Monday (the third). If Sunday, then 1st … | |
Re: You call the method three times with the same input. What makes you expect different output? | |
Re: Two things: post your code, not a link to it. Use the code-tag to format it as code. If you don't know what that means, read the intro threads on this forum, it should be in there somewhere, along with lots of other useful information. Second thing, "it doesn't give … | |
Re: No, that error message is in Interface.java | |
Re: "Symbol not found" means you're using a name that the compiler doesn't know. It could be a variable that's not visible in this part of the code (ie, you declared something in one method, but you're trying to use it in another) or you declared a variable and you're using … | |
Re: Unless you've provided your applet with a main() method, it's not surprising that you can't run it from the command line using the "java ProgName" command. To run an applet from the command line, use "appletviewer x.html" where x.html is an html file with an <applet> tag calling on your … | |
Re: Since you have it as a String, you could get chars as needed with charAt() and convert them to an int with Integer.parseInt. Or you could conceiveably use the toCharArray method to turn it into an array of chars, and walk along that. That's probably a bit faster. I don't … | |
I'm not very well up on ant, trying to learn a few things about it this afternoon. Is it possible to read in values from the command-line ant call? The scenario I have in mind is this: I want to make a generic build file that would have targets for … | |
Re: [CODE]String strRead; int p = 0; while((strRead = readBuffer.readLine())!=null){ System.out.println("readFile first step in while"); String line1 = strRead; [/CODE] this construct sets line1 to null - could this be your problem? | |
Re: For the first question, the "super" call says "run the method defined in the superclass", so it calls Dog.act(), which prints "run" and calls "eat()". When it calls eat(), however, it calls the local version of eat(), the one defined in Underdog, which again calls back to the superclass, and … | |
![]() | Re: vi and a compiler or interpreter, mostly. Eclipse for some things, but I prefer to have my hands directly on the code. For my day job (writer) I'm putting together a suite of mostly open-source tools that are doing nicely for me. Gimp, of course, for bitmap images, Oxygen for … |
Re: Scanner's a good way to go. You can get the tokens one by one with next() and handle them one at a time, or you can get the whole mess as a String and parse it yourself - use nextLine() for that. Come to think of it, I don't recall … |
The End.