Results 1 to 4 of 4
- 09-27-2011, 04:52 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 14
- Rep Power
- 0
unable to compare strings and ints
Hi everyone.
I'm trying to compare ints and strings for a networked java application, System.out.println("here") won't print, evern when todo = 1.
At a loss.
Rob.
Java Code:public static void NetLoad(int todo) { int x[] = new int[4]; int y[] = new int[4]; Ships.clear(); String[] sArray = new String[3]; System.out.println("todo = " + todo); try { System.out.println("start cc"); if (todo == 1) { int i = 0; for (Ship ship : Ships) { sArray[i++] = ship.printShip(); System.out.println("here"); } } ChatClient cc = new ChatClient(sArray) ; System.out.println("end cc"); if (todo == 0) { sArray = cc.getS(); for (int j = 0; j < 3; j++) { System.out.println("sArray + " + sArray[j]); for (int i = 0; i < 4; i++) { x[i] = Character.digit(sArray[j].charAt(i), 10); } for (int i = 5; i < 9; i++) { int yMinus = (i - 5); y[yMinus] = Character.digit(sArray[j].charAt(i), 10); } Ships.add(new Ship(x, y)); x = new int[4]; y = new int[4]; } } } catch (IOException ex) { ex.printStackTrace(); }
- 09-27-2011, 05:00 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,372
- Blog Entries
- 7
- Rep Power
- 17
Re: unable to compare strings and ints
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 09-27-2011, 05:50 PM #3
Member
- Join Date
- Sep 2011
- Posts
- 14
- Rep Power
- 0
Re: unable to compare strings and ints
Thanks,
Sorted :)Last edited by space.puffin; 09-27-2011 at 05:52 PM.
- 09-27-2011, 07:08 PM #4
Member
- Join Date
- Sep 2011
- Posts
- 14
- Rep Power
- 0
Similar Threads
-
how to compare Strings with compareTo?
By anarelle in forum New To JavaReplies: 7Last Post: 03-10-2011, 01:20 PM -
Converting ints to Strings Problem
By gkoef in forum New To JavaReplies: 7Last Post: 12-06-2010, 01:07 PM -
Compare two strings
By roud9 in forum New To JavaReplies: 1Last Post: 11-04-2010, 11:57 PM -
Compare between 2 Strings
By ChaosINC in forum New To JavaReplies: 3Last Post: 01-17-2010, 11:39 AM -
how to compare two strings
By elizabeth in forum New To JavaReplies: 7Last Post: 08-06-2007, 03:57 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks