Results 1 to 2 of 2
  1. #1
    napi1234 is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default how to write except in java??

    hello,

    i have some problems regarding on how to write exception for a job
    this is my code:

    Java Code:
    .....
    for (i=starti-1; i<=starti+1; i++){
    
    	       for (j=startj-1; j<=startj+1; j++){
    
    		   if ( i! = starti && j! = startj){
    	System.out.println( "i: "+i+"        j: "+ j +"  ");}
    ....} }


    i want to print the coordinate i and j except for both i not equal to starti and j not equal to startj [starti & startj is given earlier]. with the method i used here the code just read if i not equal starti or j not equal to start j.
    so anyone can gives idea on doing this?? :confused:
    Last edited by Fubarable; 08-09-2010 at 04:48 AM. Reason: Moderator Edit: Code tags added

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Please note that I edited your code above to add code tags so that the code will retain its formatting and be readable. To learn to do this yourself, please check out the appropriate link in my signature.

    Now, as to your problem, does your code above even compile? For something to not equal something else you don't do
    Java Code:
    if (a! = b) {  // won't work


    but rather
    Java Code:
    if (a != b) {

Similar Threads

  1. Replies: 57
    Last Post: 07-15-2010, 04:10 AM
  2. XML read/write in Java
    By bogdy.laurentiu in forum XML
    Replies: 5
    Last Post: 05-31-2010, 06:08 PM
  3. How to read/write txt in Java
    By megalomitis in forum New To Java
    Replies: 2
    Last Post: 11-13-2009, 10:09 AM
  4. How do i write this in java...?
    By johnny7white in forum New To Java
    Replies: 1
    Last Post: 11-28-2007, 07:05 PM
  5. Help with write file in java
    By mathias in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 06:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •