Results 1 to 4 of 4

Thread: Syntax question

  1. #1
    rockeater is offline Member
    Join Date
    Aug 2010
    Posts
    2
    Rep Power
    0

    Default Syntax question

    I have been working with the asterisk-java library this week and ran across a syntax I didn't recognize. I don't know what it is called so I can't search for info. Here is what I think are the pertinent lines of code

    import org.asteriskjava.manager.event.ManagerEvent;
    import org.asteriskjava.manager.event.VarSetEvent;

    public class TestEvent implements ManagerEventListener {


    ...
    ...
    ...


    //ManagerEventListener is abstract so must override onManagerEvent

    public void onManagerEvent(ManagerEvent event) {

    String eventName = event.getClass().getSimpleName();
    if (eventName.equals("VarSetEvent")) {


    //this is the syntax I don't recognize
    VarSetEvent vse = (VarSetEvent) event;


    }
    }

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

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default

    //this is the syntax I don't recognize
    VarSetEvent vse = (VarSetEvent) event;
    That's called casting. The type to cast to is enclosed in () before the variable.

  4. #4
    rockeater is offline Member
    Join Date
    Aug 2010
    Posts
    2
    Rep Power
    0

Similar Threads

  1. No more syntax error
    By ideyatech in forum Java Software
    Replies: 2
    Last Post: 04-22-2010, 05:20 AM
  2. Syntax correct?
    By dbashby in forum New To Java
    Replies: 5
    Last Post: 09-22-2009, 07:44 AM
  3. A question about syntax.
    By mr_o in forum New To Java
    Replies: 2
    Last Post: 09-19-2009, 09:30 PM
  4. Syntax-Check Your XML
    By gilbertsavier in forum XML
    Replies: 0
    Last Post: 07-17-2009, 08:37 AM
  5. syntax error
    By gabriel in forum New To Java
    Replies: 3
    Last Post: 08-03-2007, 04:26 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
  •