98 Posted Topics

Member Avatar for bheegi

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[] …

Member Avatar for kvass
0
110
Member Avatar for suct

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> …

Member Avatar for kvass
0
104
Member Avatar for ronyyy
Re: java

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 …

Member Avatar for ronyyy
0
101
Member Avatar for Dasau

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. …

Member Avatar for kvass
0
84
Member Avatar for C+Marshall

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 …

Member Avatar for kvass
0
96
Member Avatar for laelzio.mosca

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 …

Member Avatar for kvass
0
116
Member Avatar for kvass

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 …

Member Avatar for kvprajapati
0
93
Member Avatar for kvass

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 …

Member Avatar for kvass
1
135