Results 1 to 4 of 4
  1. #1
    ark
    ark is offline Senior Member
    Join Date
    Apr 2015
    Posts
    288
    Rep Power
    6

    Default How create Badformat (incom.) file exception

    If I have for example Sample.doc. How create method for bad format exception? Could be simply public void checker (String fullname, String extension) { String [] par= extension.split(".");// or simply split() as the dot is default splittes when the whitespace and other defaults could not be in file name. String ext=par[1]; if !(ext.equals(extension)) throw Badformatexception. Is it correct approach? Or I need use int i=lastindex(".") and then extract the extension by substring(i+1)? Or it is definitely not correct way to resolve the task?
    Last edited by ark; 06-06-2016 at 01:57 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: How create Badformat (incom.) file exception

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    ark
    ark is offline Senior Member
    Join Date
    Apr 2015
    Posts
    288
    Rep Power
    6

    Default Re: How create Badformat (incom.) file exception

    Would you allow do it in such way. As I can do it just from phone for this time so I am not able to format it.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: How create Badformat (incom.) file exception

    Unformatted code is hard to read and understand.
    When you post code it needs to be wrapped in code tags to preserve its formatting.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. How to create exception object in java?
    By Java Example in forum Exception Examples
    Replies: 1
    Last Post: 09-23-2014, 09:53 AM
  2. Replies: 1
    Last Post: 03-17-2014, 02:03 AM
  3. Replies: 1
    Last Post: 08-04-2010, 03:24 PM
  4. class not found exception while using IKVM to create exe for c#
    By manjunath k reddy in forum New To Java
    Replies: 0
    Last Post: 02-21-2009, 06:05 AM
  5. How to create your own Exception class
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-17-2008, 07:40 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
  •