Results 1 to 6 of 6

Thread: System warning code in java

  1. #1
    Join Date
    Dec 2009
    Posts
    296

    System warning code in java

    Hello,
    I implement a "warning system". The user can do several things that can generate warning, meaning that the application can run normally but it has detected something not "normal". Then I display just a message on the console:
    Code:
    "Warning :...."
    I could very well make
    Code:
    System.err.System.out.println("Warning :...")
    everywhere but I do not think it's very clean and there are some drawbacks including that it: a program that will use these methods will not know if warning were generated. That, in fact I am looking for something like exceptions, but I want my program still continues to turn. If you have any idea for this then please post back and very much interested in this. Thanks in advance.

  2. #2
    Join Date
    Nov 2009
    Posts
    583

    Re: System warning code in java

    Hello,
    What do you call abnormal behavior, lifting of emergency? In a good program the exception mechanism allows precisely to prevent the crash, manage abnormal behavior: if you does not display in the console, you can enjoy the catch blocks to display error messages via JOptionPane, write in a log file, send a message on a dedicated server opportunities are extended. I hope what I have tried to explain you have got it.

  3. #3
    Join Date
    Apr 2008
    Posts
    264

    Re: System warning code in java

    Hey
    I am new to java, still I have a code for you, if you think this is the one you are looking for then you can use it
    Code:
    Public sy(Phoneme head,int size) {
    		this.wel = this.getwel() ;
    		if (wel ==null){
    			wd = head.getwd() ;
    System.err.System.out.println("Warning: no wel in syllable" + this.getValue() + " (" + wd + ")" ) ;
    		}
    		else{
    			wd = wel.getwd() ;
    		}
    	}

  4. #4
    Join Date
    Nov 2009
    Posts
    343

    Re: System warning code in java

    Hello,
    Just an idea like that, you could use a singleton WarningManager your thought which maintains a list of warning. Thus, your program can "know" whether or not warnings. You can the tracers on the console with System.out.println and best use the above code as posted. I think you will need to do some modifications in the code and then you can use it in your program to success.

  5. #5
    Join Date
    Nov 2009
    Posts
    446

    Re: System warning code in java

    Hello,
    The best is to go through a special class, like:
    Here is the code:
    Code:
    public class complier (
      public static void warn (String msg) (
      System.out.println ("Warning: "+ msg ) ;
    
      }
    }
    Try this and if this does not work then you can try a different alternative. Best of Luck

  6. #6
    Join Date
    Nov 2009
    Posts
    359

    Re: System warning code in java

    Hello,
    I little modification in the above code, see if this is the one which you are looking for
    Code:
    Public class comp {
      Public static void warn(String wd, String syl){
        System.err.System.out.println("Warning: no vowels in Syllab \""+ + syl"\" in wd ....");
      }
     
      Public static void    warnAnotherError(what ever param you need here){
        :
        :
      }
    }

Similar Threads

  1. help me to understand java code (calendar java code) ?
    By so0oma in forum Software Development
    Replies: 2
    Last Post: 10-01-2011, 12:01 AM
  2. How to eliminate Event code 3036 warning from Windows 7?
    By Koyana M. in forum Operating Systems
    Replies: 3
    Last Post: 19-12-2010, 07:20 AM
  3. Getting warning in java generics
    By Angelica Maria in forum Software Development
    Replies: 5
    Last Post: 22-03-2010, 01:45 PM
  4. Replies: 9
    Last Post: 10-04-2009, 01:51 AM
  5. Warning Message : Error Code 1
    By Clemens in forum Operating Systems
    Replies: 3
    Last Post: 28-02-2009, 06:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,986,308.89133 seconds with 17 queries