2,777 Posted Topics
Re: If you cast aThat to a DynamicArrayOfInts object, you could then call the class's methods. | |
Re: > a war event takes place, no points are assigned Where are the events detected? Would that be the place to assign points? | |
Re: > how can i pass arguments Are you passing the args to a class's constructor or to a method in the class? It is coded the same way: new ClassName(<the args here>); aRefToTheClass.aMethodInClass(<the args here>); See the tutorial: http://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html | |
Re: Not sure why you are using array notation (with []s) in a for statement. Normally an int value is used. Take a look at the tutorial: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html The whole project could be done in one loop: begin loop create button add listener to button add button to container end loop | |
Re: Can you explain what the code does when it executes and what the problems are? How is the motion of the shape controlled? | |
Re: Have you made any progress since your break? | |
Re: What variable has the null value? Is that variable assigned a value before it is used? If you want any help debugging the problem, you will need to post a small, complete program that compiles, executes and shows the problem. ` while (current1 != null || current2 != null)` This … | |
Re: For debugging, You should also print out the values of miniNumber, i and number so you know what the if statement is seeing. What is wrong with what is printed out? What is the correct print out? | |
Re: Also posted at: http://www.javaprogrammingforums.com/whats-wrong-my-code/17907-help-my-library-program-please.html | |
Re: > an array, I need to check when it is out of bound The valid indexes for an array range from 0 to the length of the array-1. See this page in the tutorial: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html | |
Re: Is this your problem: Given a SimpleDate object, how do you get the needed pieces of data from it to create the String you want? Where is the SimpleDate class defined? Do you have API doc for it? What methods does it have that will return the values you want? | |
Re: > in isnt working as it should Please explain what the program does and what "is not working as it should" means. Post the output from the program. How do you test the code? Do you have a small complete program that compiles, excutes and shows the problem? | |
Re: Can you post a small complete program that shows what you are trying to do? Also post the full text of the error messages you ae getting. | |
Re: It all depends on how you want to pass the data to the recordRowObject class. What does each instance of the class contain? You could use a constructor for example. | |
Re: Sounds like you need to debug your code to see why it is not doing what you want. If you don't have an interactive debugger, try using printlns to show the values of the variables that you are using and the execution flow of your code. | |
Re: Here's a place in the tutorials about GUI programming: http://docs.oracle.com/javase/tutorial/uiswing/index.html | |
Re: The tutorial discusses the range of values a primitive can hold: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html Have you tried executing those methods to see what values they return? Call the methods with different values and print out the results. If you have any questions about the results, post the print outs that show what … | |
Re: Can you post a small complete program that compiles, executes and shows what you want? | |
Re: > How do I store the inputs of the user into the array? By using an assignment statement: ` theArray[theIndex] = theValue;` | |
Re: > give me errors Please copy the full text of the error messages and post them here. Its always a good idea to add an ending else statement to catch the case where none of the above if tests were true. Print out a message . | |
Re: Yes, for loops would be the ones to use. Can you explain what your logic for solving the problem is? You should work out the logic to use before writing any code. List the steps the code should take to solve this problem. | |
Re: > but it will also modify the value in map-m1, It sounds like there is a single object that is used as the value in both HashMaps. If you want separate objects with their own values, you need to create them. Copying a reference to an object does not create … | |
Re: > what I am doing wrong Please explain what happens. If you get errors, copy and paste them here. If the code executes without errors, what does it do? What do you want the program to do? | |
Re: Also posted at: http://www.javaprogrammingforums.com/java-theory-questions/17852-date-time-picker.html#post76428 | |
Re: > after I press that button it causes the program GUI to stop responding Where is the button that is pressed? and where is the GUI that stops? | |
Re: Can you post the full text of the error message that shows where the error happens. Be sure the code in the catch blocks calls the printStackTrace() method so the full error message is printed. | |
Re: Add more println statements to find where the last statement in the code is executed before the program exit. | |
Re: Can you post a small complete program that compiles, executes and show the problem. I don't see where you add anything to the hashmap in the code you posted. Be sure to properly format the code. The posted code does not have proper formattin with all the statements starting in … | |
Re: > figure out my problem in the code. Please explain what the problem is. If you are getting errors, copy the full text of the messages and pasted them here. | |
Re: Can you make a small complete program that compiles, executes and shows the problem? Does the code tell the container that the JLabel is added to that it needs to do a new layout of its contents? | |
Re: > times when a destination other then the closest one is selected Could you post some print outs that show the data when this happens? Print the location of the one that was selected and the location of the ones that are closer. Can you post a small complete program … | |
Re: Does the classpath point to the folder containing the res folder when the code is executed? Is the res folder(and contents) inside the jar file? | |
Re: Do you have any questions or comments for the posted code? | |
Re: Check that all the {s have a } that pairs with it. First place to look would be where the error messages start. | |
Re: Take a look at the tutorial: http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html You need to wrap any method that throws an exception in a try{}catch() block. | |
Re: You could use the Integer class to hold the value of the int. See the API doc of the Integer class for how to use it. | |
Re: > it refuses to test it. Does the code compile without errors? BTW Time is the name of a Java SE class. You should try to name your classes with different names. | |
Re: Please explain what happens when you compile and execute the program. Do you get errors? If so copy the full text and paste here. Is the output from the programn wrong? If so copy the console from when you execute the code and paste it here and add some comments … | |
Re: > Where can i see them in the properties? Are you asking how to use an IDE to debug your code? If you are asking about a problem with your code, please post the code and ask you questions about it. | |
Re: Can you post what the program prints out that shows the problem? What code should be executed every time the copy loop goes around and what code should only be executed one time after the copy loop completes? If you are confused about what goes where, post a list of … | |
Re: On windows: To copy the contents of the command prompt window: Click on Icon in upper left corner Select Edit Select 'Select All' - The selection will show Click in upper left again Select Edit and click 'Copy' Paste here. | |
Re: How do you know if a number is to go to a variable or not? Your example skips over the second 2 and the 0? A regular expression might help you extract the numbers from the String you posted. Also the StreamTokenizer class could work. | |
Re: > I'm getting the error "Subjects cannot be loaded" The code should always call the printStackTrace() method in catch blocks so you get the full text of the error message. Where does the code assign a value to the variable that has a null value? Is the assignment done before … | |
Re: One way would be to loop through the first arraylist's elements one by one and see if the second arraylist contains that element and if it does, remove it. Since there can be more than one match you'd need a loop to continue checking until all were removed. Read the … | |
Re: Can you post code without the numbers at the start of each line? > public void init, That should not compile. Can you explain what you are talking about? main() and applet ??? If you are getting compiler error messages, please copy the full text and paste them here. | |
Re: @gunvesxco Please start your own thread with your question. This thread is very old. | |
Re: Please explain the problem you are having. Post the complete text of any error messages or the program's output and show what you want the output to be. | |
Re: I suggest that you start with a simple editor and use the javac and java commands in a console window before learning how to use an IDE. See the tutorial about how to create some simple programs: http://docs.oracle.com/javase/tutorial/getStarted/cupojava/index.html When you are able to write, compile and execute some simple java … | |
Re: > how to get my input from the BufferedReader Look at the BufferedReader class for a method that will return a String when a line is read from the file. Then you can add that String to the TreeSet | |
Re: > Is there any way to solve this problem? Write a method to do what you want. Not much syntax candy in java. You can't hide the code that needs to be executed. |
The End.