Results 1 to 6 of 6
  1. #1
    javagwcc is offline Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Default length and excepton

    int a ;
    .
    .

    System.out.a.length(a.length());


    above code will throw compilar exception. This is what kind of exception ?

    Thanks in advance.

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

    Default

    The above code looks like randomly placed words. What are you trying to achieve? You can't make up syntax and expect it to work.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    And by the way, it doesn't throw an exception but rather causes a compilation error. There's a difference that will help you to learn about.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by javagwcc View Post
    int a ;
    .
    .

    System.out.a.length(a.length());


    above code will throw compilar exception. This is what kind of exception ?

    Thanks in advance.
    There is nothing called compiler exceptions in general, it's compiler error or compile time error used in common. What you are trying to do?

  5. #5
    javagwcc is offline Member
    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Default length() method and excepton

    I am very happy by looking the replyes....thanks ....

    I am actually trying to understand the Exception classification along with examples.

    I know that, when we compile it will not compile.

    In broad level exceptions are 1. Unchecked exceptions ( run time )
    2. checked exceptions ( compile time )

    Under which catagory my exception(e.length()) will come, is it under checked exception ?

    On what base these two are classified ???

    Can I have smalll example for these both types, Plz..... ???

    I referred couple of books but they are confusing me .....

  6. #6
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    952
    Rep Power
    5

    Default

    Quote Originally Posted by javagwcc View Post
    In broad level exceptions are 1. Unchecked exceptions ( run time )
    2. checked exceptions ( compile time )
    This is really not a good description of checked and unchecked exceptions. Exceptions are always runtime. The difference with checked exceptions is that the compiler requires you to either:
    a) handle the exception, or
    b) declare in your method signature that the exception may be thrown.

    The exception itself is still something that would be thrown at runtime, but the compiler requires you to explicitly declare how it should be handled.

    Hope that helps,

    -Gary-

Similar Threads

  1. Increase signature length?
    By xcallmejudasx in forum Suggestions & Feedback
    Replies: 3
    Last Post: 12-18-2008, 07:04 PM
  2. what does num.length method does?
    By kris09 in forum New To Java
    Replies: 1
    Last Post: 08-07-2008, 11:19 PM
  3. queue length of Socket
    By hemant in forum Networking
    Replies: 6
    Last Post: 07-13-2008, 07:28 PM
  4. Integer length
    By jithan in forum New To Java
    Replies: 1
    Last Post: 06-12-2008, 04:35 PM
  5. Help with method length
    By toby in forum New To Java
    Replies: 1
    Last Post: 07-25-2007, 09:29 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
  •