202 Posted Topics

Member Avatar for mallak alrooh

No one here will write code for you. You need to ask a more specific question. What is it you are having problems with? Choose one issue to ask about at a time. If you have a question on a different topic, then start a new thread.

Member Avatar for kramerd
0
119
Member Avatar for printmatic

You only have one loop, but I think you need two: One loop goes over each character in the input, converting letters to numbers. Another loop is needed to see if the user wants to keep entering more numbers by checking for the '#' character. The first loop should be …

Member Avatar for kramerd
0
273
Member Avatar for Xufyan

The purpose of getters & setters is to hide the implementation of a datatype from the "user" (usually another programmer). If I write a class, I usually need a way to allow you to set up the data the way you want, but I don't necessarily want you to know …

Member Avatar for imtiyaz41
0
460
Member Avatar for k.santhan

[URL="http://www.daniweb.com/forums/thread99132.html"]http://www.daniweb.com/forums/thread99132.html[/URL]

Member Avatar for kramerd
-1
41
Member Avatar for iphoneepidemic

If you post your code in code tags, it will appear with line numbers. That helps in determining where the problem occurs. The way you are trying to initialize your arrays in Maze1 and Maze2 won't work. Try this instead: [CODE] class Maze2{ String structure[][] = { {" ", "1 …

Member Avatar for iphoneepidemic
0
284
Member Avatar for jems5

On line 7 you are trying to add the contents of your 2D array (which is empty), when JamesCherrill suggested you just add row+col. Try changing line 7 to store the sum row+col in your test variable.

Member Avatar for jems5
0
2K
Member Avatar for rinjin07

Not sure what other class you're talking about, but as to your second question, replace ??? with amount. If you post code again in the future, please enclose it in code tags.

Member Avatar for rinjin07
0
192
Member Avatar for iphoneepidemic

Please post your question again but put your code in code tags, and print the text of the error message you are getting.

Member Avatar for iphoneepidemic
0
133
Member Avatar for AaronLLF

Looks like maybe you could change line 75 from [CODE]public void gameLoop()[/CODE] to [code]public static void main(String[] args)[/code]

Member Avatar for kramerd
0
681
Member Avatar for cool girl

You cannot decrement the size of the array. Arrays have a fixed size in Java. If the size of the array must remain accurate to the content, you could create a new array and then copy all but the deleted element from the old array into the new array. Note …

Member Avatar for kramerd
0
118
Member Avatar for ceyesuma

I'm not familiar specifically with Apache Derby, but usually when you download a JDBC driver, there's a jar file which you need to put in your classpath. Did the file you downloaded include a jar file? Did you put the jar file in your classpath?

Member Avatar for ceyesuma
0
2K
Member Avatar for DoEds

You need to implement either Comparable or Comparator. Look up Arrays.sort in the javadoc and you will find links to these.

Member Avatar for JamesCherrill
0
128
Member Avatar for sirlink99

It looks like you have an extra closing curly brace just before the line you've highlighted in red. Try to remove that one. Next time, please post your code inside code markers. Also, if you use an IDE like eclipse, that will help you match up your {'s and }'s.

Member Avatar for JamesCherrill
0
159
Member Avatar for rcogq7

Constructing an array of objects in java is a 2 step process. First you create the array of references. Then you must construct the actual objects. You have skipped the second step. You only have an array of references, but the references don't point to actual objects. You can not …

Member Avatar for kramerd
0
234
Member Avatar for sciprog1

I am not getting the same error you are, but my simple TCP client/server program does not work in a single instance of BlueJ. However, if I run BlueJ twice, then I can run the server in one instance and the client in the other and that works.

Member Avatar for sciprog1
0
122
Member Avatar for compe_dsd

The syntax for comparing a string to several values to see which one matches is something like this: [CODE] if (input.equals(value1)) { // handle value 1 here } else if (input.equals(value2)) { // handle value 2 here } else if (input.equals(value3)) { // handle value 3 here } // ... …

Member Avatar for kramerd
0
572
Member Avatar for Kimmelivim

To time how long some process takes you can use an algorithm like this: 1. set a "start" variable to System.currentTimeMillis() 2. do whatever it is you want to time 3. set a "stop" variable to System.currentTimeMillis() 4. calculate an elapsed time by subtracting the start time from the stop …

Member Avatar for Kimmelivim
0
167
Member Avatar for nwalser

What about MyStack? Presumably it implements the push and pop methods, right? If so you need to call pop from superPop, and call push from superPush.

Member Avatar for kramerd
0
198
Member Avatar for cool girl

Here are some links which might help. [URL="http://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/"]http://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/[/URL] [URL="http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o"]http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o[/URL] [URL="http://en.wikipedia.org/wiki/Big_O_notation"]http://en.wikipedia.org/wiki/Big_O_notation[/URL]

Member Avatar for kramerd
-1
158
Member Avatar for doctorjo5

When you add an action listener to some object (like a button), the object that you add must implement the ActionListener interface, which contains one method called actionPerformed. The way this works is when you click a button, the JVM will notify any "interested parties" of the event, meaning it …

Member Avatar for kramerd
0
2K
Member Avatar for dalip_007
Member Avatar for AirGear

According to [URL="http://www.javaworld.com/javaworld/javatips/jw-javatip24.html"]this web site[/URL], you need to import the sun.audio package. Haven't tried this myself, but maybe you can get it to work? Here's another [URL="http://download.oracle.com/javase/6/docs/technotes/guides/sound/programmer_guide/contents.html"]resource from Oracle[/URL] that's much more in-depth. Here's one more [URL="http://www.dreamincode.net/forums/topic/14083-incredibly-easy-way-to-play-sounds/"]link[/URL] which may help. BTW, my search terms in Google were "java add sound …

Member Avatar for AirGear
0
141
Member Avatar for rayden150

I had to add 2 lines to Cliente.java: [CODE] package mensajes; import javax.swing.*; [/CODE] Then the code compiled & ran. I did not see the errors you mention above.

Member Avatar for kramerd
0
136
Member Avatar for dmor574

What exactly is your question? How do you run the class above when it doesn't have a main? BTW, your code tags worked perfectly.

Member Avatar for dmor574
0
118
Member Avatar for babyboy70

If you are trying to read input from the command line, check out the Scanner class in the Javadoc. If you want a GUI, look up JOptionPane. In either case, when you get a string of input from the user, you can check in a loop whether each character in …

Member Avatar for kramerd
0
56
Member Avatar for python_user

See [URL="http://download.oracle.com/javase/tutorial/uiswing/components/editorpane.html"]http://download.oracle.com/javase/tutorial/uiswing/components/editorpane.html[/URL]

Member Avatar for kramerd
0
147
Member Avatar for flyingcurry

There are 2 key ideas in recursive algorithms. The first is the problem must be something that can be broken down into simpler steps in an iterative manner. The second is the iteration must have a well defined stopping point. Factorial is a common example because it has a "natural" …

Member Avatar for flyingcurry
0
2K
Member Avatar for Protoroll

Change line 26 to [code] this(species, autumnColor, price); [/code] Also, there's no need for the check on lines 27-28, since a boolean can only be either true or false in Java. There is no other possible value it can be.

Member Avatar for ~s.o.s~
0
106
Member Avatar for rob3097

Yes, I think your formulas are incorrect, since the program calculates a negative balance after about 14 years. :) You can get the program to pause using Thread.sleep(n);, where n is a number of milliseconds, rather than asking the user to hit a key. This needs to go in a …

Member Avatar for kramerd
0
159
Member Avatar for xc3ss1v3

When you catch an exception, print out the stack trace using ex.printStackTrace(). Then put the results here so we can see what's going wrong.

Member Avatar for xc3ss1v3
0
667
Member Avatar for jtresue
Member Avatar for jtresue
0
138
Member Avatar for jliao20

According to your comment, hasNext() is supposed to return true if there are more elements in the list, but the code returns true when cursor.next == null. Isn't that backwards? Also in next(), you check if hasNext() is true, then you say there is no such element. This also seems …

Member Avatar for kramerd
0
7K
Member Avatar for judgemental
Member Avatar for javaAddict
0
462
Member Avatar for 080346

If you use FlowLayout and the container is wide enough, both text fields will appear in the same row. You either need to make your container more narrow so the next text field will appear in the next row, or use a different layout manager. Probably GridLayout would be the …

Member Avatar for kramerd
0
103
Member Avatar for mannyaz
Member Avatar for poornimashobana

I'm not sure I understand what you are asking for, but if you want some practice coding in Java, try this site: [URL="http://codingbat.com/java"]http://codingbat.com/java[/URL].

Member Avatar for melessa
0
87
Member Avatar for purijatin
Member Avatar for samuel17

On line 15 your are using an assignment rather than a comparison. Change = to ==.

Member Avatar for samuel17
0
196
Member Avatar for Katana24

Since MPanel is not complete, and you haven't included your main game class, I created a tester and just put your scoreBoard panel on a JFrame. Everything seems to be working fine. So I also added a button to try to update the scoreBoard like you're doing in MPanel, and …

Member Avatar for Katana24
0
2K
Member Avatar for rocky86

To convert an integer to a String: [CODE]int x = 1234567; String str = "" + x;[/CODE] Look up charAt in String class documentation for extracting individual characters from a string.

Member Avatar for kramerd
0
74
Member Avatar for Xufyan

I don't understand what tong1 was trying to say, but you cannot overload a method in java by changing the return type alone. Overloaded methods must have different parameter lists (and it is the datatypes that count, not their names). So for example, public void f1(int n) and public void …

Member Avatar for Xufyan
0
1K
Member Avatar for Xufyan
Member Avatar for Xufyan
0
108
Member Avatar for Slowly

You probably already know if you had the File object, you could recreate the Scanner and that would reset the pointer to the beginning of the file. But since you don't have that, you need to rethink your loops. Can you think of a way to combine both checking for …

Member Avatar for Slowly
0
5K
Member Avatar for Bahubali

Have you tried adding a row to your table model? See [URL="http://download.oracle.com/javase/tutorial/uiswing/components/table.html"]http://download.oracle.com/javase/tutorial/uiswing/components/table.html[/URL] for some help.

Member Avatar for kramerd
0
62
Member Avatar for sw8revenge

This forum is not a place where people will write code for you. You need to ask a more specific question. Your question is too vague/broad so no one here is going to be able to help you.

Member Avatar for kramerd
0
54
Member Avatar for prashanth.p.560
Member Avatar for NewOrder

This is because your while loop says while (true), and the only place where you break out of the loop you "return" from main. Either change the condition of the loop using your stop variable, or change the return statement to a break statement, which will just break out of …

Member Avatar for kramerd
0
188
Member Avatar for pavan146

In java you can create a label to use with loops, break & continue statements. See [URL="http://www.janeg.ca/scjp/flow/labels.html"]http://www.janeg.ca/scjp/flow/labels.html[/URL] for an example of how this works. The syntax for creating a label is an identifier, followed by a colon. Then remember that single-line comments in java start with //. So the code …

Member Avatar for pavan146
0
108
Member Avatar for rameezh88

It looks like you are mixing up where to do error checking. To fix this you should move String host=(args.length<1)?null:args[0]; into main before you create your new ChatClient, and then pass host into the constructor instead of args[0]. But you also need to be careful about the order of your …

Member Avatar for rameezh88
0
117
Member Avatar for wadelucy

Here's an algorithm that should help. 1. Put digits into an array. E.g., int digits[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; 2. Write some code that generates 2 random numbers between 0 & 9. Store the random numbers in 2 variables, say num1 and num2. …

Member Avatar for kramerd
0
94

The End.