7,116 Posted Topics
Re: Here's Oracles brief operating instructions for jconsole https://docs.oracle.com/javase/tutorial/jmx/overview/javavm.html ... but what do you really want/need to know? I can't imagine that a memory address is going to be useful to you. | |
Re: ... and it's not great code - obviously written by someone with limited Java skills, so it's not a good example to follow. (Even less a good piece of code to copy and claim as your own.) | |
Re: Looking at your SQL statement (line 37) it lookslike you have a comma right at the end - just before the closing ) Maybe that's the syntax error? | |
Re: JTextArea has an `append(String s)` method that you call to add text to the end of whatever is currently being displayed in the text area (which starts out empty). So before your loop, create a text area and add it to a JFrame that's visible on the screen. Use a … | |
Re: What level of phone - just a voice'n'texts basic model, or an internet-connected smartphone? | |
Re: Remember that a switch case will drop through into the following case unless it has a break; So you are on the right tracks there except that you don't need lines 27, 28 or 33. If you enter case 3 then it will print 3 french hens then drop through … | |
Re: After a very quick look at that code I see 5 threads: The main thread obj1 obj1.t obj2 obj2.t of which main, obj1.t and ob2.t are started but you try to join obj1 and obj2, which have not been started | |
Re: Although your individual Bank methods are synchronised, this only means that calls to each of those methods *for the same Bank object* will not overlap. It looks like you want each execution of BankInstance's run method to complete before the next one starts. If so, you need to synchronise the … | |
Re: Without seeing the exact code that generates that error messgae it's imposiible to say. But in general, if you have an array of objects you definitely can access their public getter methods to retrieve the values of their instance variables. | |
Re: Sorry Rubberman. Despite your impressive experience the first hex number is NOT separated from the rest by dual colons . Suzy's last post is correct. See RFC5952 https://tools.ietf.org/html/rfc5952#section-2.2 One (and only one) sequence of zero fields can be replaced by a:: It's also recommended that :: is not used for … | |
Re: Sorry necrovore, that would add an asterisk to every line. Between lines 19 and 20 would be better. The problem is that on the last line the loop lines 6-9 is not executed, so the variable `a` does not get set, so it keeps its previous value of 1, which … | |
Re: Exactly what help do you need? | |
Re: Please post the exact complete error message - copy/paste it, don't just give us your summarised version | |
Re: There's a complete example in the introductory description in the standard API documentation | |
Re: You don't multiply the color values together! You multiply the color values by the corresponding values in the 3x3 matrix, then divide by the sum of the matrix. With a matrix of all 1's that's particularly trivial - you are multiplying the values by 1 (!), adding the results, and … | |
Re: You split each line into words (line 19) but then you do nothing with that, you just add the complete line to your ArrayList. But anyway, the only way I can see for you to get gibberish output like that is if your default charset doesn't match the actual file's … | |
Re: The result could be as long as the longer input aray, or 1 digit longer than that (if you end up witha carry), so maybe the easiest way is to set up 3 arrays of length (longest input +1), read the inputs into two of them and calc the result … | |
Re: "ascending" is defined by the compareTo method. a,b is ascending iff `a.compareTo(b) >0` If you reverse the test inside the compareTo so that `a.compareTo(b) <0` then you have just definied a,b as a descending sequence. | |
Re: We don't know where you're wrong either. What have you done so far? | |
Re: 24: compareTo returns an int -1, 0, or +1, but not a boolean 31/32: you can't have method calls like that on the LHS of an assignment. You probably want to use `set` to change the contents of the list | |
Re: 1. Decide which platform you are going to major in. It's not hard to learn a new language; algorithms and techniques are mostly portable; but to be good at games you need to understand the actual API/graphics tools in all their horrible detail with all their horrible quirks and work-arounds. … | |
Re: So, you have published you teacher's original (copyrighted?) assignment here. And what did you expect to achieve by that? | |
Re: or you could simply use a loop (in pseudo-code): int posCount=0, negCount=0 while (more input to process) input next number if (next number > 0) posCOunt++ else negCount++ print counts | |
Re: That logic looks suspicious! Maybe something like this (in pseudocode) would work better for each row in the result set { use the noRoom to find the corresponding button if status is "filled" set button red else set button green } | |
Re: Start by reading the instructions... "store the values in Card object with the attributes symbol and number." ... but also, when you need to add a new key/value pair you use the unhelpfully-named `array` for the value. You keep adding numbers to that, so (1) it keeps getting bigger and … | |
Re: The "unknown source" is just referring to the internals of the Java API classes (for which the source code is not on your computer). The first lines of the message tell you what you need to know... ArrayIndexOutOfBoundsException: 0 at myGUI.Summary.actionPerformed(Summary.java:67) that looks like line 111 in the code as … | |
Re: Your understanding is wrong in that the key/value pair is not replaced, just the value. The API doc says "If the map previously contained a mapping for the key, the old value is replaced." Your `equals` method defines two Accounts as being the same if the name fields are equal, … | |
Re: static = one value, shared for all instances of the class non-static = every instance has its own values | |
Re: That cast converts a char numeric value to an int by padding it arithmetically. What you seem to want is to parse a character value in the range '0' - '9' to the numeric value it represents. Remember the char '0' is a numeric value of decimal 48 in ASCII | |
Re: hazelkahn So we don't delete all your posts as junk, can you please explain what you are trying to do. Do you want solutions to these exercises? Are you proposing them as good exercises for learners to try? Something else? | |
Re: Yes, some people here do have such source code. If you give us your teacher's email them we could email it directly to him/her and save you the effort of pretending that you wrote it. Alternatively, you could read the DaniWeb Rules that you agreed to when you signed up, … | |
Re: Same problem as in your previous post: "sum" is not a Java type, nor a class. Line 8 also has invalid syntax for calling a method | |
Re: You have to use the `Console` class and its `readPassword` methods. In that case it's probably easier to drop the BufferedReader and just use Console's `readLine`. Docs are in the usual place. | |
Re: A couple of hints to get you started: You changed the signature of the method by adding a parameter. That's not what is required. You declared a variable for the track name. A name is usually a String, not a Track object | |
Re: You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. There are lots of people here who will freely give their time to help you become the best Java … | |
Re: The > operator only works for numeric primitives. Depending on the type of the generic arguent that could mean Circle1 > Circle2 (etc) Because all your generics implement Comparable. you must call `compareTo` rather than using numeric operators | |
Re: You didn't say what your question was, but... decide whether you are using i,j or row,col - don't mix them Don't forget to print the answers | |
Re: ( 9 / 5 ) 9 and 5 are both ints, so the division is done in integer arithmetic, giving the result 1 | |
Re: Sorting the array is massive overkill for just finding the largest entry, and permanently changes the array, which may also be undesirable. stultuske's "try this logic instead" approach is by far the best. | |
Re: "someone give me a code" ? ! This is not a site for the lazy, the cheat, or the selfish entitled. This is a site for people who want to work and to learn. You may want to think again about what you just posted. | |
Re: Even better, do that and also make sure your names accurately reflect their use. If I see a method `void setColor(String colors)` then I would expect to be able to pass more than one color in the String parameter. Far better to do it properly: public void setColor(String color){ this.color … | |
Re: Maybe: You have video code like loop do CPU intensive stuff wait 20 mSec that's only going to loop 50 times per second if the CPU stuff is instantaneous (which stuff like yours will definitely not be) At the very least you need something more like loop endTime = time … | |
Re: After you read the first int, the next call will read the second number int num1 = f.nextInt(); // reads 1nd num int num2 = f.nextInt(); // reads 2nd num similarly in the loop you can call nextInt twice to get the two numbers and put them into the 2D … | |
Re: ? That reads the wrong way round... If you do not set a seed then the Random() constructor picks one - eg current time in mSec - so two runs will provide different sequences. If you set a seed and it's the the same, then you will get the same … | |
Re: Before people write too much code... What is the purpose of this class? Does it just hold some standard colors for yor app, and/or do you want to be able to retrive those colors by a name which is a variable at run time? Colors are immutable, so you don't … | |
Re: Oh dear, divinity02 139 posts and you don't yet know that you must: 1 start a new thread for a new question and 2 show what you have done | |
Re: The "standard" answer is to have a "model" class that contains the input data and performs the calculation. You create an instance of the and pass it as a parameter to the constructor of all your GUI classes. Now ny GUI class can use the its input fields to set … | |
Re: Hint: Some of the classes you can use without an import include String and System. What package are they in? | |
Re: It's obviously designed with the assumption that it will only encode/decode A-Z, so it's not surprising that it fails with a blank in the input. Having said that... args[0] is maybe just the first word of your input, the other words being in args[1] etc, depending on how you typed … |
The End.