Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: brain bench question

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default brain bench question

    public class Test {
    public static void main(String[] args) {
    if (args[0].equals("b") && checkFoo(args)) {
    System.out.println("if evaluated to true.");
    }

    System.out.println("x");
    }
    private static boolean checkFoo(String[] args) {
    System.out.println("Checking..");

    return args.length > 0;
    }
    }
    What is the result of running the above code sample with the following command "java Test a e"?
    Choice 1 Checking.. X
    Choice 2 if evaluated to true.
    Checking..X
    Choice 3 if evaluated to true. X
    Choice 4 It does not compile.
    Choice 5 x


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: brain bench question

    Please post your code correctly, make an attempt to answer the question, then ask for feedback.

Similar Threads

  1. brain bench question
    By soumya186 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 8th, 2014, 01:50 PM
  2. brain bench question
    By soumya186 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 8th, 2014, 01:48 PM
  3. brain bench question
    By soumya186 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 8th, 2014, 01:42 PM
  4. Iterators and lists and oh god my brain hurts!
    By Brodie337 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 8th, 2011, 04:44 PM