Forum: Java Jul 17th, 2009 |
| Replies: 8 Views: 615 Hi.
Well, at first - you don't change the "index" variable from the time, when it was created. You should specify the current index (since you're displaying not the first record of your array).
... |
Forum: Java Jul 17th, 2009 |
| Replies: 14 Views: 485 Using "array[number]" you're refer to 1 single element in array, which has a position [B]number-1[B] (since the array indexes are starting from 0).
If you need to pass whole array - pass just the... |
Forum: Java Jul 16th, 2009 |
| Replies: 12 Views: 1,676 Sure .. here we go:
The Test class in this program represents your console window. It has some methods, but the one you're interested in is: cls().
What actually it does in the main method:
1.... |
Forum: Java Jul 16th, 2009 |
| Replies: 12 Views: 1,676 The link, I gave you, contains the discussion, where your questions were explained .. also it gives one more example of clearing :) |
Forum: Java Jul 16th, 2009 |
| Replies: 12 Views: 1,676 Hello, I haven't faced such problem before .. maybe this might help you:
Java Programming [Archive] - Clear screen? (http://forums.sun.com/thread.jspa?threadID=228168&messageID=1028281) |
Forum: Java Jul 15th, 2009 |
| Replies: 19 Views: 488 |
Forum: Java Jul 15th, 2009 |
| Replies: 19 Views: 488 How about use this:
arr[i+1][j]=sum;
instead of:
arr2[i+1][j-1]=sum; |
Forum: Java Jul 15th, 2009 |
| Replies: 19 Views: 488 uhu .. what if you would use just "j" (considering that you're extracting 1 from "x" on your next steps):
arr2[i+1][x-1]=sum;
System.out.print(arr2[i+1][x-1]); |
Forum: Java Jul 15th, 2009 |
| Replies: 19 Views: 488 Ok, good job.
But your code still remain tricky:
int arr[][]=new int[20][20];
int arr2[][]=new int[20][20];
Look, you missed the main thing of using 2 dimensional array. The point is: while... |
Forum: Java Jul 15th, 2009 |
| Replies: 19 Views: 488 I can help (that's what I'm actually do) .. but the ready-made code won't make from you
.. till you won't fully understand it.
If you interested - I can explain the jagged array for you. If you... |
Forum: Java Jul 15th, 2009 |
| Replies: 19 Views: 488 You won't program it correctly till you get the details of how it works. Let's unwrap the cycles. No indexes and such .. just the way, how it should go:
there's 2 things I've changed to make it more... |
Forum: Java Jul 15th, 2009 |
| Replies: 19 Views: 488 No, I can't, because We only give homework help to those who show effort (http://www.daniweb.com/forums/announcement9-2.html) |
Forum: Java Jul 15th, 2009 |
| Replies: 19 Views: 488 Hey, akulkarni.
There're some logic errors:
1. for(j=5;j>0;j--)
{
i=0;
while(i<5)
{
int c=arr[i][j]+arr[i][j-1];
System.out.print(c);
i++; |
Forum: Java Apr 19th, 2009 |
| Replies: 13 Views: 495 Ok, if I understand you correctly, you need to write to the JList the messages, recieved from server (for client). Step by step, using given example:
1. Create model
DefaultListModel saveList =... |
Forum: Java Apr 19th, 2009 |
| Replies: 13 Views: 495 All this (working with JList using model) you have in your server code. |
Forum: Java Apr 19th, 2009 |
| Replies: 13 Views: 495 Well, let's look closer to example given there (I mean the points of attention):
//create a model
final DefaultListModel model = new DefaultListModel();
//creating JList based on our model... |
Forum: Java Apr 19th, 2009 |
| Replies: 13 Views: 495 In one of the links, that I gave you (Advanced JList Programming) there is a potion for you. "Lists with Dynamic Contents" .. with example to play around :) |
Forum: Java Apr 19th, 2009 |
| Replies: 13 Views: 495 Well, if your client-server interaction part works fine (I mean, that you're able to establish connection and transfer some data). Then all you have to do is somehow (depends on in which view you... |
Forum: Java Apr 19th, 2009 |
| Replies: 9 Views: 449 |
Forum: Java Apr 19th, 2009 |
| Replies: 9 Views: 449 Hello, skiing.
As Ezzaral said, for comparing objects of self-created data types, you need to add realization Comparable interface in that class. In other words - you're kinda saying "The objects of... |
Forum: Java Apr 19th, 2009 |
| Replies: 13 Views: 495 Hello, pjpro.
There're some variables/methods in your code, that you use but haven't declared (such as "ListDemo", "display", "enter"). That is the source of the compilation errors.
If I was you... |
Forum: Java Mar 20th, 2009 |
| Replies: 3 Views: 291 Hello, milgo. You have in your program definition of a Product class. And as far as I understood, you was going to use it in Inventory class. But instead of that, you're creating an instance of Item:... |
Forum: Java Mar 19th, 2009 |
| Replies: 8 Views: 413 Hello, charlie81. Well, you have class Main_Class, which has method public static void main(String[] args) (which is an entry point into your program). And in that method you're defining new class... |
Forum: Java Mar 15th, 2009 |
| Replies: 7 Views: 723 Well, if follow your's app logic: the Category must be a part of the Item (belongs to it). So if I were you - I would place the definition of it in Item class. And then import it from that class for... |
Forum: Java Mar 15th, 2009 |
| Replies: 7 Views: 723 Ok, in this place you can use simple construction, like:
category = eCategory.valueOf(scanToken.next()); |
Forum: Java Mar 15th, 2009 |
| Replies: 7 Views: 723 Hello, kbullard516. I was playing around with your code. Here's what I have so far:
(simply I've turned your words in code :P )
public int compareTo(Object other)
{
String otherName =... |
Forum: Java Jan 29th, 2009 |
| Replies: 9 Views: 531 When you do this:
Person vn = new Person("dingh","Ding");
you initialize only two fields, calling this:
Person(String brukernavn, String navn) {
this.brukernavn = brukernavn;
... |
Forum: Java Jan 22nd, 2009 |
| Replies: 5 Views: 695 Just to add: you can use the alternative way (a bit longer, but still can be useful some day :) ). For the case, if you don't want to interrupt your prog when the user inputs the incorrect value. You... |
Forum: Java Jan 21st, 2009 |
| Replies: 1 Views: 1,558 Hello, Allen.
You close your BufferedWriter bw in the cycle (when you are writing data into the file). So in the best case you'll have an empty file ... in worst - an exception.
Just take it out of... |
Forum: Java Jan 19th, 2009 |
| Replies: 14 Views: 1,690 It happened because you calling maxF and maxC methods before you are filling arrays inputFahr and inputCel with data. And your maximum goes through arrays, filled by default values (in your case it's... |
Forum: Java Jan 10th, 2009 |
| Replies: 3 Views: 306 I hope, this may help you:
Object-Oriented Data Structures Using Java... |
Forum: Java Jan 6th, 2009 |
| Replies: 2 Views: 305 1. Are you sure, that your example is correct 2,15,4 which = 2,3,4 ... and not 16 = 3?
2. You don't check the case, when you get, for example 4,2,3. In that case your (x == 2) and (ex == 1), but it... |
Forum: Java Jan 6th, 2009 |
| Replies: 6 Views: 451 This error caused by whitespace between '_' and 'minTemperature' here:
_ minTemperature= minTemperature; |
Forum: Java Jan 6th, 2009 |
| Replies: 6 Views: 455 Also, you have interesting name for variable, that keep returning value ('nothing'). If you want return nothing from method, you should use void keyword.
For your code it's:
public static int... |
Forum: Java Jan 6th, 2009 |
| Replies: 6 Views: 455 Hello, hypocrisy.
For keeping distinct numbers, you can use, for example Class ArrayList<E> (http://java.sun.com/j2se/1.5.0/docs/api/java/util/ArrayList.html). This class contains method to check,... |
Forum: Java Jan 4th, 2009 |
| Replies: 11 Views: 650 If I were you, I would probably do that:
1. Create a class, that will represent a single card (it will contain rank, suit). I suppose it will be better to use enum to list all possible suits and... |
Forum: Java Jan 4th, 2009 |
| Replies: 11 Views: 650 Hello, javaman2. You have mistake in logic here:
if(((x==1)&&(cardSuit==0))&&((x==2)&&(cardSuit==0) )&&((x==3)&&(cardSuit==0)))
All that expression contains only '&&' condition. So if a bit... |
Forum: Java Dec 22nd, 2008 |
| Replies: 13 Views: 998 I have a little variation on your 'old' code. It is not the best solution, but it is better than nothing. You can analyse it and make summary for yourself:
public void fillBoard()
{
... |
Forum: Java Dec 22nd, 2008 |
| Replies: 13 Views: 998 So your question is solved? If so, please mark thread as solved :) |
Forum: Java Dec 22nd, 2008 |
| Replies: 13 Views: 998 Hello, llemes4011.
Hm ... interesting task. Your problem here:
// If the number already appears in the row and the column, change the booleans to false to check again... |