3,927 Posted Topics
Re: Well, apparently whoever wrote those methods are using that class as a key or with reflection. I don't see how you expect anyone to know the "why" details of someone else's code based upon a method signature. | |
Re: Well, the error message says why. Did you read it? It also indicates the line on which the error occurred. | |
Re: Arrays are zero based, so for 'n' elements, you have index values 0 to n-1. Therefore, this loop[code]for (i=1;i<=n;i++)[/code]will skip the first element and run to n, which is past the end of the array. You need to loop[code]for (i=0;i<n;i++)[/code] | |
Re: I'm not going to count each line to find line 45, but it's most likely your first access of the "transition" array in Thread1. "(cnt*(cnt-1)/2)" is most likely coming up zero and leaving you with zero-length arrays. | |
Re: >and i dont mind if u can give me the whole code for this program So, actually you are perfectly ok with cheating, even though you claim you don't want to. Read your class notes, get a program outline or at least a decent amount of pseudo code together on … | |
Re: It was a conspiracy by the folks who make plastic tamper-proof seals :P | |
Re: [QUOTE=javaman2;801609]forget it i found it out thanks for nothing[/QUOTE] With posts like this, "nothing" is pretty much what you are likely to get in the future as well. | |
Re: Take a look at the constructor you wrote for Rectangle and compare that to the code you are using to create it (which you are doing when you add the "new" keyword). You have collected the info to use that constructor, you just aren't doing so. | |
Re: Well, the first thing you need to fix is your paintComponent() method. If you override that method, you cannot arbitrarily change its signature. It must match the original method, which this does not[code] public void paintComponent(Graphics a,Graphics g){[/code]It should be[code] public void paintComponent(Graphics g){[/code]The method you have written is not … | |
Re: The reason is [URL="http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html"]The Java Language Specification[/URL] - that is just how it is. | |
Re: When you try to call "drawCircle" where? Because in your code above, you don't have any call to that method, nor do you create an instance of your Circle class. You certainly don't want this in your Circle class constructor[code]Circle circle = new Circle();[/code]because it's going to call itself recursively … | |
Re: Start with this: [url]http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html[/url] If you have specific questions, post back with them. | |
Re: Start with this: [url]http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html[/url] That will tell you what you need to know to compile and run from a command window. | |
Re: Definitely. Pretty neat... until they turn on us... :twisted: | |
Re: He is referring to the "Read Me:" posts at the top of this forum: [url]http://www.daniweb.com/forums/forum64.html[/url] | |
Re: Are your class files in a different folder than your source files? Do the file names match the class names? | |
Re: There are a couple of different ways you can do it. Either of the provided Timer classes can be used to schedule a repeated task to update your internal variables (i.e. seconds). You can read about [URL="http://java.sun.com/products/jfc/tsc/articles/timer/"]when to use which here[/URL]. Alternately, you could have a simple thread running a … | |
Re: 1. Nontheist (100%) 2. Secular Humanism (100%) Not a very difficult call for their quiz to make. | |
Re: Well, I guess that would depend on what it's "refreshing" wouldn't it? Start with this tutorial: [url]http://java.sun.com/docs/books/tutorial/uiswing/events/actionlistener.html[/url] | |
Re: [QUOTE=Nollyvenon;797623]how do i create java code that randomly assign numbers to letters,[/QUOTE]With [URL="http://java.sun.com/javase/6/docs/api/java/util/Random.html"]Random[/URL] and a [URL="http://java.sun.com/javase/6/docs/api/java/util/HashMap.html"]HashMap[/URL] I suppose. [QUOTE=Nollyvenon;797623]sum them,[/QUOTE]"+" operator. [QUOTE=Nollyvenon;797623]display them[/QUOTE] A console or a [URL="http://java.sun.com/docs/books/tutorial/uiswing/index.html"]Swing GUI[/URL] [QUOTE=Nollyvenon;797623]and store them in a database[/QUOTE] [URL="http://java.sun.com/docs/books/tutorial/jdbc/index.html"]JDBC[/URL] | |
Re: [URL="http://www.openoffice.org/"]OpenOffice[/URL] has a Java API as well. | |
Re: What errors? You didn't specify what they are. Have you read the stack trace of the error? It indicates the nature of the problem and the line number. | |
Re: Well, you definitely need to replace all of those print statements with a loop that prints each line item from the array. There is absolutely no reason to type all of that in manually - it only differs by the array index. I'd recommend writing a small data class (a … | |
Re: One thing to note on the do-while loop verruckt24 posted above: You probably want a normal while() loop there instead of the do-while(), otherwise you're performing the loop code before checking the user's response. | |
Re: That's because you aren't repainting the background rectangle before you paint the oval. Even so, you really should do your custom painting on a lightweight component such as a JPanel or small JComponent class that overrides paintComponent(), rather then painting directly on the JFrame. Here is your code with a … | |
Re: They will start you with the most entry-level tasks they can find. That may be fixing a few simple bugs in certain packages, adding a trivial feature to an existing code section, or anything else that lets you get acquainted with the code base and style with minimal interference to … | |
Re: First thing, use [noparse][code] [/code][/noparse] tags around any code that you post. No one wants to try to read that huge unformatted wall of text you just dumped on the page. Second, [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] Lastly, how do you intend to specify the frame you want to grab? Your question is extremely … | |
Re: Oh, I think it's printing the cart just fine. The problem is that your menu choice handler creates a new cart every time it's called. | |
Re: >When I run my program I input 1 sales figure and the program goes into a never ending loop. Why? Because you never change this condition[code]while (dollars > 0) {[/code] >and where are all the tallies "*" beside my references coming from and why They are coming from your loop … | |
Re: And stephenpeter, don't shout your questions in all caps. It's rude. | |
Re: So did you input 2 numbers for it to use? Your scanner is waiting for input. | |
Re: First, use [noparse][code] [/code][/noparse] tags around your code so it remains readable. Second, get the "double" out of that expression you posted the error on (line 30). It doesn't belong in there. Lastly, I don't think [icode]input.next.Int()[/icode] is a valid method on the the Scanner class. Check the API. | |
Re: Well, you're going to need a variable to keep track of the largest number entered so far. If you think about it a minute, updating that variable should be pretty easy in your input loop. On a side note, never throw exceptions from main(). Use a try-catch block. Also, use … | |
Re: The [URL="http://java.sun.com/javase/6/docs/technotes/guides/collections/index.html"]Collections Framework[/URL] has implementations of many such data structures. You only have to write your own if you need functionality that is not available with the existing ones - and even then you can probably just use composition to delegate most of the work to an existing implementation and … | |
Re: [QUOTE=stephen84s;793482]And what would you do after you find "that" partner you are looking for ?[/QUOTE] [URL="http://www.southparkstudios.com/clips/153471"]Professor Chaos is born...[/URL] | |
Re: [QUOTE=GEVIII;791504]I Have That Same Problem........Will somebody please help!!!!!!!!!!!![/QUOTE] That's not enough exclamation points to bring the posters back from 2004. | |
Re: Take a look at the [URL="http://java.sun.com/javase/6/docs/api/java/lang/String.html#split(java.lang.String)"]String.split()[/URL] method. Scanner would work for that as well. | |
Re: Ok, there are actually two issues on that line. Your "index" variable is declared as double but used as an integer index to your array. It should be declared int. Secondly, inFile.next() returns a String. You cannot directly store that into an array of double. | |
Re: You're getting the null pointer because you have declared the "db" variable, but you have not initialized it in main(). | |
Re: Don't declare variables with the same names as methods and if you want to share those arrays between methods, you'll need to declare them at the class level. Currently they are local to your methods and are not visible to any code outside those methods. | |
Re: Edit your post and use [noparse][code] [/code][/noparse] tags around your code. Reading that unformatted wall of text will turn many away. | |
Re: Mostly because there is nothing up the call stack to deal with it. I guess it's just a pet peeve when I see that because too often you see students writing their entire program in main() and slapping a throws clause up there without even really knowing what it does … | |
Re: Perhaps the following will help: [url]http://www.exampledepot.com/egs/javax.swing.text/style_HiliteWords2.html[/url] | |
Re: Well, the first place to start would be here at the tutorial on networking: [url]http://java.sun.com/docs/books/tutorial/networking/index.html[/url] As a basic outline, you would need to maintain a collection of URLs to visit, connect to each URL and retrieve the content, parse the content and store what you want in the database, then … | |
Re: I would add another vote for Avast. I use it at home myself. | |
Re: The problem is that you have overridden the complete painting behavior of the JFrame (and the components within it) by replacing its paint() method. At the very least, you would want to place a call to [ICODE]super.paint(g);[/ICODE] before your own code. A better solution would be to add a small … | |
Re: [QUOTE=PRASENJITBISWAS;779483]Hi Am a student of BCA. Can you help me to learn about Hacking.[/QUOTE] Fail. | |
Re: If you can't keep track of 6 or 12 cokes and your own rate of consumption well enough to tell if someone's stealing them, you certainly aren't smart enough to figure out an algorithm for it. You probably aren't even smart enough to be working there at all. | |
Re: Only 40% - a poor test. I've been into metal for over 20 years :P [QUOTE]ride the lightning master of puppets (close second) and justice for all theblack album otherwise known as "metallica" (this ranking will undoubtably lead to flamewars) kill em all load/reload ( crap) st. anger (total and … | |
Re: I seriously doubt you are going to get anyone to fill in the blanks for you on this. It sounds too much like a [I]current[/I] quiz and that won't fly well here. Perhaps you should ask specific question about portion that you do not understand or fill in what you … |
The End.