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 4 of 4

Thread: need to know how the code is running

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default need to know how the code is running

    public void test(int x)
    {
    int odd = 1;
    if(odd) // if i write odd==1 it works but i have used this in C a number of times.
    {
    System.out.println("odd");
    }
    else
    {
    System.out.println("even");//output compilation error
    }
    }
    Last edited by Dark knight; July 19th, 2012 at 03:00 AM.


  2. #2
    Member
    Join Date
    Jul 2012
    Posts
    83
    My Mood
    Cynical
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: need to know how the code is running

    This is a double post of an already active question: help needed to know how the code is running

    If I were a moderator on this forum, I'd close this thread and chastise you for needlessly splitting up a discussion. Perhaps you didn't mean to ask this question in two places? You should probably state in both of these threads which one is the active one so as not to mislead anyone.
    Last edited by Fubarable; July 19th, 2012 at 12:28 AM.

  3. #3
    Junior Member
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: need to know how the code is running

    ohk sorry my bad!!!!! i was going to ask a different question accidentally copy pasted this one...

  4. #4
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: need to know how the code is running

    Quote Originally Posted by Dark knight View Post
    ...i have used this in C a number of times...
    When I was a tadpole (on a medium-sized water planet in a galaxy far, far away) the teacher made us write things 100 times on our (underwater) blackboard.

    With modern Earth technology, it is a little easier:

    public class WriteOnBlackboard
    {
        public static void main(String [] args)
        {
            for (int i = 0; i < 100; i++)
            {
                System.out.println("In spite of some syntactical similarity: Java is not C.  Lots of stuff that works in C is totally bogus Java!");
            }
        }
    }

    Output:


    In spite of some syntactical similarity: Java is not C. Lots of stuff that works in C is totally bogus Java!
    In spite of some syntactical similarity: Java is not C. Lots of stuff that works in C is totally bogus Java!
    In spite of some syntactical similarity: Java is not C. Lots of stuff that works in C is totally bogus Java!
    .
    .
    .


    Bottom line (in case you missed it): Java is not C.

    And, while you are at it, try to imagine how a tadpole can write anything. (Ouch!)

    School was a lot tougher way back when.



    Cheers!


    Z
    Last edited by Zaphod_b; July 19th, 2012 at 09:35 AM.

  5. The Following User Says Thank You to Zaphod_b For This Useful Post:

    Dark knight (July 19th, 2012)

Similar Threads

  1. [SOLVED] n00b having problems running code
    By cha0s619 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: November 10th, 2012, 03:31 PM
  2. help needed to know how the code is running
    By Dark knight in forum Java Theory & Questions
    Replies: 9
    Last Post: July 30th, 2012, 06:18 PM
  3. running jinternalframe
    By cnjiru in forum AWT / Java Swing
    Replies: 0
    Last Post: May 25th, 2012, 12:49 PM
  4. HELP! Gui is running fine, don't know exactly how to code.
    By cc11rocks in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 12th, 2011, 01:12 PM
  5. Running a external exe in Mac OS
    By supertreta in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: November 15th, 2010, 12:32 PM