Results 1 to 2 of 2
  1. #1
    toad is offline Member
    Join Date
    Oct 2007
    Posts
    11
    Rep Power
    0

    Default Java Review Question

    I am working on a review for my midterm and need some help with a problem.
    Java Code:
     This is the question:
    
    if array a is int[] a = {1, 2, 3}, what is a[0] - a[2]?
    
    a.	1
    b.	2
    c.	3
    d.	None of the above
    I am guessing that the answer is: b

    Anyone know if I am right? If it is not "b" why is it not "b"?

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    a[0] is 1 and a[2] is 3. So the answer is -2 which is "d".

Similar Threads

  1. Question mark colon operator question
    By orchid in forum Advanced Java
    Replies: 9
    Last Post: 12-19-2010, 08:49 AM
  2. New Comer, Java C# question
    By lmei007 in forum Advanced Java
    Replies: 0
    Last Post: 02-04-2008, 04:54 PM
  3. Java Pacman question
    By whdbstjr90 in forum New To Java
    Replies: 0
    Last Post: 12-11-2007, 11:28 PM
  4. Java Review
    By toad in forum New To Java
    Replies: 5
    Last Post: 12-08-2007, 01:28 AM
  5. Question abt.reading xml file using java
    By gvi in forum Advanced Java
    Replies: 6
    Last Post: 11-08-2007, 05:48 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
  •