- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 25
- Posts with Upvotes
- 23
- Upvoting Members
- 18
- Downvotes Received
- 6
- Posts with Downvotes
- 5
- Downvoting Members
- 3
Re: Out of curiosity, what sorting algorithm does the Collections class' sort method use? | |
Re: Why can't the farm class create a new Chick object with the syntax Chick(true) or Chick(false) depending on if it is young or old? And you can also add a randomizer if you wanted to, and add isYoung() and isOld() methods. And why can't you add that method to the … | |
Re: I remember browsing through the API and finding a Robot class and it looked cool so I clicked on it and I was amazed that there was an object that let you control the mouse movement on the screen xD So much crazy stuff to do with the API ^^ | |
Hey everyone! I was recently introduced to Ruby and am trying to learn it by working my way through the Ruby on Rails 3 Tutorial, but I got a little stuck on autotesting. The guide says that for Windows I should install "Growl for Windows," which I did, and then … | |
Re: @einjelle: you have your math wrong. The program is right. Multiplication is evaluated prior to addition and subtraction, so 5 + 3 * 8 - 4 becomes 5 + 24 - 4 which is equal to 25, not 17. For the next one, division and multiplication again come before addition, … | |
Re: Take a look at the free program Installer Creator -- it lets you set up an install wizard for your program and makes it appear to be exe-ish (an icon shows up in your start menu and on ur desktop etc that you can double click that will link to … | |
Hey guys! So I recently started exploring the InetAddress object, and came across 2 methods which confused me: [ICODE]getHostName()[/ICODE] and [ICODE]getCanonicalHostName()[/ICODE]. I don't fully understand the difference between a canonical host name (fqdn) and a general host name, so if someone could explain the distinction to me in detail that … | |
Re: Excuse ztini's rudeness, but I think what s/he meant to say was that we aren't going to solve a problem for you u need to show effort and then we can help you out. However, if you are at a loss as to where to turn, you might want to … | |
Hi all! In a course I am T.A.ing, one of the students submitted this program as their assignment and I did not fully understand why it wasn't working: [CODE=Java] public class Alphabet { public static void main (String[] args) { char alphabet= 'A'; System.out.println("The following is the English alphabet."); while … | |
Hey guys! So I was wondering -- what's the syntax for updating a JTable that is being displayed on the screen? I know how to allow cells to be edited, but what if I want to like add in entirely new rows while it's being displayed? I tried repaint() and … | |
Hey Everyone! I need some help with a JTable I'm working on. [CODE] TableColumn column = table.getColumnModel().getColumn(2); ... JComboBox comboBox = new JComboBox(); comboBox.addItem("A"); comboBox.addItem("B"); comboBox.addItem("C"); comboBox.addItem("D"); comboBox.addItem("E"); comboBox.addItem("F"); column.setCellEditor(new DefaultCellEditor(comboBox)); [/CODE] I know that the code above will take the column of the table at index 2 and give … | |
| Re: Can you be a little more specific...? Maybe post some of your code here? |
Re: Actually you can just use the System class' arraycopy method, which is designed specifically for this purpose. Check it out in the java api -- the documentation for the arraycopy method is pretty straightforward but if you have any questions with it don't be afraid to ask :) Iterating over … | |
Re: Jeez guys you could give mango a lil' more help than that. S/he clearly isn't playing mp3 files for a school project or something so it's for personal edification -- just give a lil' more guidance... Personally, I've always wondered how to play mp3 files but I have yet to … | |
Re: The problem seems to be in your constructor -- it looks like you are missing the code that initializes the instance variables of the class to the variables passed into the constructor. | |
Re: Here's a very simple example of recursion to help you get started with understanding it: Problem: Write a program to add all the numbers from 1 to X. Solution: [CODE] public static int addFrom1(int x) { if (x<1) return 0; else if (x==1) return 1; else return x + addFrom1(x-1); … | |
Re: I have no idea how what e-man suggested will work at all... Here's what I would do: [CODE] print "Enter series of numbers to calculate the average. Enter 0 to end." while exit is false: Prompt user for #. if # is 0, set exit to true. otherwise, add that … | |
Hey guys I'm working on a program that asks the user to enter a month and year and then prints that month's calendar page on the screen. However, to do this I created a daysBetween() method that accepts 2 dates and finds the number of days between them. So basically … | |
Re: First off if the number has already been placed in the array, you want the user to pick a different number. Right now let's say my set is [4,0,0,0,0] after the first time thru and then I want to put in another 4 for the 2nd slot, the computer will … | |
Re: On line 7 you set the size to int[4], meaning you are using indexes 0-3. In your loop you try to access index 4, which does not exist. To fix this, change line 7 to: [CODE] int numbers[] = new int[5]; [/CODE] | |
Re: XD the problem actually is not in the snippet of code you posted here. You are printing the contents of the Array, namely, the three Punt objects. But it doesn't know how to print a "Punt object" so it is printing the memory address of the objects. If you go … | |
Re: [CODE] import java.util.Scanner; //Same as "include" statement //Lets you use a Scanner object to get input. public class Add2 //Creates a new program named "Add2" { //This is what is inside the program. public static void main(String[] args) //Where the code starts (same as "int main()") { //Begins the "main" … | |
Re: [B][U]Arrays[/U][/B] [INDENT]To create an array use the following general syntax: [ICODE]dataType[] arrayName = new dataType[arraySize];[/ICODE] Accessing Size: [ICODE]arr.length[/ICODE] Accessing Data: [ICODE]arr[index][/ICODE] Modifying Data: [ICODE]arr[index] = var[/ICODE] Insertion: Not Applicable Deletion: Not Applicable [/INDENT] [B][U]ArrayLists[/U][/B] [INDENT]To create an ArrayList use the following general syntax: [ICODE]ArrayList<DataType> arrayName = new ArrayList<DataType>();[/ICODE] Accessing Size: … | |
Re: Imagine a simple branch structure: [CODE] | / \ | | / \ \ [/CODE] The number of leaves for the top part will be the total number of leaves on the left + the total number of leaves on the right. [INDENT]On the left there is again a branch, … | |
Re: Ok I'm not going to tell you what to do, but here's what's happening with the code you provided: You start off with p set to 1. p % 2 does equal 1, so the first time thru, p = p * i, where i is 1. p = 1 … | |
Re: Rofl at least he's being rly honest and straightforward about what he's asking for ;) We definitely want to help you out, but we want you to first try it out yourself. If you get stuck, post your issue and code here and we'll help -- but we want to … | |
Re: You should work from the highest amount of money down. If the highest form of change is 100s, then first check how many 100s are in the number. Then however many there are, subtract it from the number. i.e. if you have $532 you will end with 5 hundreds, and … | |
Re: [CODE] Loop: >> Read in string from user >> Check length of string >> If length == 5: >> Parse the integer from the string (if you're dealing with integers) >> Exit loop [/CODE] Above is the pseudocode for how I would approach the problem. If you use a loop, … | |
Re: The problem is in this line [ICODE]for(x=0;x<sample.length();x++)[/ICODE]. First of all, in order to access the size of an array, you need to call .length without the () afterward. However, even if you modified the line to read [ICODE]for(x=0;x<sample.length;x++)[/ICODE], your code would still be flawed, because the sample array may be … |