98 Posted Topics
Re: The first step is to make sure you fully understand the concept of an [URL="http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html"]arraylist[/URL]. Once you do, check out this code -- I think the simplest approach is to use an arraylist of arraylists to represent the theaters: [CODE=Java] import java.util.ArrayList; public class Cinema { public static void main(String[] … | |
Re: I'm not really sure what you are trying to do, but one thing that might help you is a for-each loop. The syntax is as follows: [CODE=Java] for (One instance of a type : A collection of that type) { //Iterate through the list. } [/CODE] For example, [CODE=Java] ArrayList<String> … | |
Re: Here's something to think about to jumpstart your forming of an algorithm -- consider using nested loops. Have the outer loop keep track of the row and each time it completes have it jump to the next row, and have the inner loop print the contents of the row. Think … | |
Re: I can't see the rest of your code, but it's possible that the string has a null value and thus doesn't have a length of zero. There is a difference between an empty string and a null string. An empty string is like a thread with no beads on it. … | |
Re: I think I might know the issue. If you are saying in your code System.out.println(num1+num2+num3) to print the 3 numbers, your error is here. The print method is adding the integers together and then is printing them. If you add the integers to an empty string and print it as … | |
Re: Every method call needs to match the way it was set up. Since you have a method called "void reverse(int units)", the method call is going to need to be set up so it enters a number of units and returns nothing. If you say System.out.println(myCar.reverse()), you are going to … | |
Can someone please write a piece of code for the following and comment each line (except for really simple ones like int x = 5;) explaining what it does? Objective: write a program that "spins a number wheel" in the background while waiting for you to type "stop" -- when … | |
Hi everyone! This code runs without throwing exceptions and stuff, but it doesn't exactly run when I click the "Submit" button -- what is supposed to happen is that I click it and it generates a random number. What happens is either nothing or if I get lucky and click … |