2,777 Posted Topics
Re: You should use the equals() method for comparing Strings. | |
Re: Your interpretation of the assignment makes no sense. [QUOTE]calcProfit() calculates and returns the profit[/QUOTE] You display on the screen by call the print or println method. | |
Re: [QUOTE]how do i fix this?[/QUOTE] Test the value of the indexes and make sure it is in bounds BEFORE using it to index into an array. You could use an if statement to test the indexes' values and skip using them if they are out of range. Or check your … | |
Re: [QUOTE] program to realize what colour it's about to go onto, [/QUOTE] The BufferedImage class has methods for getting the color of a pixel. Are the colored area bounded by shapes that could be used to test where the moving item is going? | |
Re: You will need to supply a lot more information about what you are trying to do. | |
Re: [QUOTE]Exception in thread "main" java.lang.NullPointerException at Soft_eng.ATM.main(ATM.java:226)[/QUOTE] Look at line 226 and find what variable has a null value. Then backtrack in the code to see why that variable does not have a valid value. If the variable is in an array, check why the index into the array is … | |
Re: Where is the JOptionPane you are having problems with? I don't see where you have one that tries to show the numbers you are talking about. | |
Re: [QUOTE]how to write code to exit for this program[/QUOTE] Code this where you want to exit: System.exit(0); If you just want to exit from a method, use the return statement. | |
Re: Can you copy the console from when you execute the program that shows what the problem is. Add comments to the post where there is a problem and show what you want the output to be. Why do you use MAX_VALUE in this loop? for(int i = 0; i < … | |
Re: Are you going to write the code for the graphs or are you looking for a package that draws graphs? | |
Re: You don't need a JDK to execute a jar file, you do need a JRE. [QUOTE]unsupported major minor error 51.0.[/QUOTE] The source was compiled with 1.7 but the java program is an older version. Either compile the source with 1.6 or execute the jar file with 1.7 | |
Re: Java has methods, not functions. The split() method starts with s not S | |
Re: Does the Keyboard class have a static method: readint()? [QUOTE]Integer age = new Integer(); age.parseInt(Keyboard.readint() );[/QUOTE] Is this a typo? There is a ; in the middle of the statement. Don't put two statements on the same line. The parseInt method is static, you do not need an instance of … | |
Re: Check that all the {}s are properly matched. Your formatting makes it very hard to visually scan the code. | |
Re: [QUOTE]My question is that my argument '2' is not working,[/QUOTE] Please explain what you mean by "not working". Show the console from when you execute the code and add comments to it showing what it wrong with the way the program is executing. On Windows To copy the contents of … | |
Re: Here's a link where you can find the API doc for the Scanner class: [url]http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/[/url] | |
Re: Start with basic java and branch out as your design requires. | |
Re: You can read any part of a file with RandomAccessFile. However if you want to insert data into the file (and not just add to the end) and make the file larger, you will have to read all of the file's bytes so that the bytes after the insert point … | |
Re: Please explain what you want to do. You can output to the console with System.out.printnln() You can read from the console using System.in | |
Re: What java code are you executing the generates the error? How and where is the code being executed? | |
Re: Look at the AppletContext class's getApplets method and the showDocument method. | |
Re: [QUOTE]how I can read each line of the console[/QUOTE] The Scanner class has easy to use methods for reading from the console. [QUOTE]if they range between the letter A-Z then store in an array..[/QUOTE] Are you talking about single characters: A or b or K or about Strings of characters: … | |
Re: Methods do specific things. What are the "things" the posted code does? If you can say this code does this and that code does that, that would be a natural splitting point for creating some methods. Create some method definitions with {} and cut and paste the code into the … | |
Re: Have you tried printing out the int values of those characters so we can see what they are? If you want help, you need to print out their values and post it here using a technique as shown by James or this one shown below. [CODE] String s = (the … | |
Re: Cross posted at [url]http://www.java-forums.org/new-java/55524-brick-breaker-design-pattern.html[/url] | |
![]() | |
Re: The readLine() method is for reading lines. A line ends with an line end character. The readLine method will continue reading until it gets a lineend. Some solutions: Use the read method and read the data into an array as it comes or have the sender add line end characters | |
Re: What have you tried? What happens when you change the hardcoded 8s to a variable and then set that variable to the number that you want? Post the output that shows the problem and explain what is wrong with it. What is the algorithm that describes what goes on each … | |
Re: For debugging and seeing what code is doing as it executes, add lots of printlns that print out the values of variables and conditions used in if tests and to show execution flow through the methods.. The print outs will show you what the program is doing so you can … | |
Re: Here's how to copy the command prompt so it can be posted allowing copy and paste of the contents into further comments. 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 … | |
Re: I'm not sure what techniques you can use to parse the String: "1, 2, and 3." and find the numeric digits that are to be replaced with text without looping. switch statements are a way to "jump" to a block of code based on a value. Some think it a … | |
Re: Is the itemListener being called two times? Add a println to show when it is called and what the value of the args are. | |
Re: Think of a file as a long strip of paper with designs on it. If you want to remove a design, you have to make a cut in the paper just after the design and drag the end piece over the design you want to remove. | |
Re: I thought that notepad was a MS program. How do you read it? What do you get when you read the notepad.exe file? Do you mean text files? The Apache project has some packages (?called POI) for reading PDF files. Google for it | |
Re: Did you remove the layout manager so that you have exclusive control vs competing with the layout manager over who gets to set the location of a component? | |
Re: Please edit your post and properly indent the code to show the nesting levels with pairs of {} Also remove the } from the end of a statement and put it on its own line. This code hides the ending } and makes the code very hard to read. [QUOTE]help … | |
Re: One of the easier classes to use for reading text files is the Scanner class. Use an array for putting what is read into an array. | |
Re: [QUOTE] i get red lines underneath[/QUOTE] The red lines are missing from your post. Can you compile the source code, get the error messages and post them here? | |
Re: What is contained in a Current object? Does it have methods for getting at its contents? | |
Re: Could you preload the Scanner input by changing this line to have valid input. static Scanner in = new Scanner("4 4\n"); //System.in); For debug testing it is easier if the program doesn't have to ask for the input. The correct input is provided every time without user intervention. | |
Re: [QUOTE]I need to make it capable of holding more than one number at a time, anytime you push one now the thing is just reset. [/QUOTE] What is the "it"? Is that the JLabel. What String do you pass to the setLabel() method? Is that what you want to change? | |
Re: [QUOTE][Ljava.lang.Character;@2e3fe12e[/QUOTE] That is the value returned when you call an array of character's toString() method for example when you are trying to print it. If you want to see all the characters in the array, use the Arrays class's toString() method to format it for printing. | |
Re: Can you explain what your code does now, show its output and explain what the problem with it is? | |
Re: The value you get is in hours: 2.4666 hours. How many minutes in an hour? If you multiply the fractional part by the minutes per hour you'll get the number of minutes. See the Math class for rounding methods. | |
Re: Do you have any questions or problems? Please ask. Post the full text of the error messages you get. Post the output from the program showing what it outputs. | |
Re: [QUOTE]how to make it update[/QUOTE] Can you explain your problem a bit more? Is the problem that the code to do the update is NOT being called or is the problem that the code is not doing the update correctly? | |
Re: You need to study how layout managers work. Each container (like a JFrame) uses a layout manager. The layout manager controls where components that are added to the container are positioned. Try the tutorials: [url]http://download.oracle.com/javase/tutorial/reallybigindex.html[/url] Go to the above and Find layout | |
![]() | Re: [QUOTE] I still have trouble actually sending a file[/QUOTE] Can you explain in more detail what the problem is? Here are two compiler problems I got when I tried to compile your program. [QUOTE]SimpleServer.java:67: cannot find symbol symbol : constructor BufferedReader(int) location: class java.io.BufferedReader BufferedReader bfr = new BufferedReader(inputFromClient.read(buffer)); ^ … |
Re: Have a list of the clients. Go through the list and send to each client. | |
Re: [QUOTE]i want to find if elements of row numbers[1] are equal to elements of row numbers[2];[/QUOTE] Are you to test if all are equal or only some? For example: 1,2,3 equals 1,2,3 but does not equal 1,4,3 what about: 1,2,3 and 3,1,2? What will the results of the compare be? … |
The End.