- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 51
- Posts with Upvotes
- 49
- Upvoting Members
- 29
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
202 Posted Topics
Re: It is significant if you have a million nodes. You won't need to traverse to the end of the list if you simply maintain a tail reference to the last node. | |
Re: Can you ask a more specific question? What is it you don't understand? | |
Re: [QUOTE]Caused by: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.6.0_20\bin\FirstApplet\class.class (The system cannot find the path specified)[/QUOTE] It looks like the browser or appletviewer is looking for the applet in the wrong place. You should have the .html file and the .class file in the same directory so the browser or appletviewer can find your … | |
Re: hatux, please start a new thread when you have a question of your own. This thread belongs to enuff4life concerning the original post. | |
Re: Here's an example: public class MyClass { // member variable can't be accessed directly in static method private String name; public static void main(String[] args) { // create an object to access its member variables MyClass test = new MyClass(); test.name = "any name"; // ... do some other stuff … | |
Re: You can read about borders [here](http://docs.oracle.com/javase/tutorial/uiswing/components/border.html). The page starts with this comment. > "Every JComponent can have one or more borders. Borders are incredibly useful objects that, while not themselves components, know how to draw the edges of Swing components. Borders are useful not only for drawing lines and fancy … | |
Re: You could store the user's guess in an array of characters which you initialize with '-' characters. When the user gets a letter correct, put that letter in the correct spot in the array. Then when you display the array you will have the dashes and the letters in the … | |
Re: The problem is you are not incrementing index inside your while loop so you're always looking at the first character of the input string. | |
Re: According to [URL="http://jroller.com/mipsJava/entry/sizeof_java_objects"]this article[/URL], a Vector in Java takes 80 bytes and each Double takes 16. Unfortunately it is not possible to store a primitive type in a collection like LinkedList or HashMap. The best (most memory efficient) route, as JamesCherrill suggested, is to use an array of primitive types. … | |
Re: I would write a helper method, call it something like [ICODE]foundPrevious[/ICODE], that takes your array, an index, and a string. It's a boolean method that searches the array from index 0 up to the input index searching for the input string. If it finds the string at any point, it … | |
Re: According to [URL="http://www.ibm.com/developerworks/java/library/j-webstart/"]this document[/URL]: [QUOTE]All the files for your application must be stored in a set of JAR files, including resources such as images and sound files.[/QUOTE] | |
Re: This is not exactly the same as your question, but perhaps it will help? [URL="http://stackoverflow.com/questions/2150265/retrieve-an-image-stored-as-blob-on-a-mysql-db"]http://stackoverflow.com/questions/2150265/retrieve-an-image-stored-as-blob-on-a-mysql-db[/URL] | |
Re: The first error says you are using a variable called [ICODE]average[/ICODE] which you haven't declared. The rest of the errors have to do with the [ICODE]TextIO[/ICODE] class, probably because you're missing an import statement. If you post again, please put your code inside CODE tags so it gets properly indented … | |
Re: The error is probably because the call to [ICODE]nextInt[/ICODE] on line 29 does not advance the read pointer to the next line. Try moving line 28 to after line 29 and take the comment marker off. If this doesn't fix the problem, please post your student class and attach the … | |
Re: Not enough info to determine what the problem is. Please post your entire program. | |
Re: If you have a new question, please mark this thread solved and start a new thread. | |
Re: What you have looks close to what you need. Just some things are a bit out of order. 1. Move line 22 to come before line 20. 2. You need more variables to keep track of your data: - 1 variable to store the total number of marks entered. I … | |
Re: Let's start with a definition of "inventory management system". What does this mean to you? Can you describe some of the features such a system would have? | |
Re: When I run your program I get the following output: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> [/CODE] If I change to [url]www.google.com[/url] I get the following: [CODE] <!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Google</title><script>window.google={kEI:"Di_sTNHhLoeMeLqA1Z0B",kEXPI:"27690,27818",kCSI:{e:"27690,27818",ei:"Di_sTNHhLoeMeLqA1Z0B",expi:"27690,27818"},ml:function(){},kHL:"en",time:function(){return(new Date).getTime()},log:function(b,d, [/CODE] | |
Re: You need two main loops for this program. The outer one runs the test inside 50 times. The inner one goes the number of times the user asks for. I would use 4 arrays with 6 elements each for this problem. The first array stores the number of dice rolls … | |
Re: I'm guessing you really mean sending an object, not a class. Is that right? An object can be serialized in a number of ways and sent through a stream. There is a serialization mechanism in Java (google it), but you can also write out the data in an object to … | |
Re: You said in your first post that Java is an ambiguous language. This is not true. Ambiguous means there is more than one way to interpret it. This is a feature of natural languages, but is very bad in programming languages. However, what Java is, is very general purpose, which … | |
![]() | Re: You should start by trying to read the input file. Just write a program that opens the file, reads each line and prints them out. Test this to make sure it works. Next, modify your program to create an array of ints based on the first number you read from … |
Re: Here's an example of bubble sort on an array of int's copied from [URL="http://www.dreamincode.net/code/snippet513.htm"]this web page[/URL]. [CODE] private void bubbleSort(int[] unsortedArray, int length) { int temp, counter, index; for(counter=0; counter<length-1; counter++) { //Loop once for each element in the array. for(index=0; index<length-1-counter; index++) { //Once for each element, minus the … | |
Re: If I understand your question correctly, I think what you need is a [URL="http://download.oracle.com/javase/6/docs/api/javax/swing/JScrollPane.html"]JScrollPane[/URL]. | |
Re: This can be done using a [URL="http://download.oracle.com/javase/6/docs/api/javax/swing/JComboBox.html"]JComboBox[/URL]. | |
Re: I believe it comes from the word "template", and Java also uses the term "generic", which you can google. The idea is that you want a data structure that can operate on any kind of data. So you don't want to write a Binary Tree class that only deals with … | |
Re: First you need to get your menu working in a loop: On line 20 put [icode]boolean done = false;[/icode]. Then between lines 21 & 22, put [icode]while (!done) {[/icode]. Then between lines 43 & 44 put [icode]done = true;[/icode]. Then between lines 45 & 46 put another close curly brace. … | |
Re: In your printf statement, you use %d which is used for integers, but you associate with that the variable t, which is a double. The error message is saying that %d cannot be used with a double. | |
Re: You might want to post this question in one of the database forums if you don't get an answer here. | |
Re: Here are the 1st 3 links that come up if you search google for "java array tutorial". (There are many more if you don't like these.) [URL="http://download.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html"]http://download.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html[/URL] [URL="http://www.tutorialhero.com/tutorial-76-java_arrays.php"]http://www.tutorialhero.com/tutorial-76-java_arrays.php[/URL] [URL="http://www.learn-java-tutorial.com/Java-Arrays.cfm"]http://www.learn-java-tutorial.com/Java-Arrays.cfm[/URL] | |
Re: [URL="http://www.daniweb.com/forums/thread80130.html"]This thread[/URL] has some info that might help. | |
Re: [QUOTE]The program works well offline on my desktop.[/QUOTE] Have you tried running it locally from within the Jar file? Does that work? Can you run it using appletviewer? I don't see anything obviously wrong with your HTML. If the above tests don't shed any light, post the jar & the … | |
Re: When you do [icode]new Thread() {...}.start();[/icode], you are creating an unnamed class and using it right where you declare it. I understand you are asking how to call setDaemon using this syntax, but I'm not sure it's possible. So my question is, why can't you create a named class for … | |
Re: This is the Java forum. Please move this post the the JavaScript forum under Web Development. | |
Re: You need to think about this problem a bit. Imagine a counter counting the seconds. It starts at 0, then goes to 1, 2, 3, ... etc. How do you know when a minute has elapsed? | |
Re: 1. get_hours() method should not declare local variable _hours; should return member variable hours instead. Same for get_payrate() method. 2. You need to ask a question to get further help. What is it you don't know how to do? | |
Re: maybe you want getScreenResolution() instead? | |
Re: 1. I think you want an array of integers rather than doubles. 2. According to the problem definition, I think you need your array to be 51 elements long (in order to include both 0 and 50). 3. You need to initialize the array so that all the numbers are … | |
Re: [icode].length()[/icode] will give you a string's length. [icode].charAt(i)[/icode], where i is an integer will give you the individual character at position i in the string (remember that indices in Java start at 0). So in a loop that goes from 0 to length-1, you can check whether each character is … | |
Re: You can cast the result to the appropriate type: [CODE] un = (ArraySet<String>)one.union(two); [/CODE] | |
Re: For some reason your code doesn't have line numbers. Usually when you post with code tags, it numbers the lines. Anyway, you have an extra close curly brace after your 2nd constructor. Remove this - all of the code in the class needs to be within the curly braces. [CODE] … | |
Re: Here's what I understand from your post. - You have a text file with some string data and some numeric data. - The string data all comes first before the numbers - The tag [Set 1] indicates the beginning of the numbers - The tag [End Set 1] comes after … | |
Re: If you write the number out as a string rather than an int, it will be in ASCII. For example: [CODE] int number = 5; String text = "" + number; [/CODE] Since writing to a file is much slower than storing data in memory, you might want to create … | |
Re: I don't think this code will compile. What is "deal"? It looks like your button is called press. | |
Re: What apines said is correct, but if you want to use methods, you can write boolean methods that will test if the diceSum has one of the values you are interested in. For example, [CODE] private boolean playerWins(int diceSum) { return diceSum == 2 || diceSum == 3 || diceSum … | |
Re: Do you get an error? If so, please put the text of the error message in your post. Did you create the jar or get it from someone else? If you are creating it yourself, [URL="http://www.rgagnon.com/javadetails/java-0166.html"]this article[/URL] might be useful. | |
Re: This doesn't work on a JPanel, but you can set the enclosing window (JFrame or JDialog, etc.) to be not resizable. You work really hard getting the layout just right, and then you don't want the user messing it up by resizing the window. Just call [ICODE]setResizable(false);[/ICODE] on the enclosing … | |
Re: 1. Please post your code inside code tags in the future. 2. A bar chart is more useful when you can see all the bars together, so I think System.out.println makes more sense than showing one bar of output at a time using JOptionPane, unless you are required to display … |
The End.