Results 1 to 6 of 6

Thread: Need Help!

  1. #1
    milet is offline Member
    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0

    Default Need Help!

    I need help if someone can make me an example of these 4 things in the same program that would be great!
    loop, an array, an if-else statement, and methods

  2. #2
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    9

    Default

    Hello Milet, welcome to the Java Forums.

    Have you actually attempted to do this yourself yet? The best way to learn is to do it!!

    What you want to do is really quite simple and is the very basics of Java.

    See what you can come up with and post back here and we can help you to correct any mistakes.

    Also, please note, a more descriptive title in encouraged in these forums.
    Last edited by DonCash; 04-29-2008 at 03:31 PM.
    Did this post help you? Please me! :cool:

  3. #3
    milet is offline Member
    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0

    Default

    Well when i say im new to java i mean very new so I am just looking for a example with all these with maybe a few notes in it to explain because I'm just trying to learn a few small things at the moment

  4. #4
    Zosden's Avatar
    Zosden is offline Senior Member
    Join Date
    Apr 2008
    Posts
    384
    Rep Power
    7

    Default

    try my website it will teach correct Java programming techinques My Website
    My IP address is 127.0.0.1

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

    Default

    Hi milet,

    Welcome to our community. :)

    Did you start to read any book or something on Java. If you are a really newbie for Java, it's better to refer well explained book my friend. Or you can read a well organized tutorial as well. Suns' official web site have a really nice tutorial.

    On the other hand you can start work with simple tutorials too. Zosden have such a nice thing on his website.

    Here is a simple code segment. But I'm not sure how far you an get it. ;)

    Java Code:
        private void allInOne() {
        // Declaring an array of 5 elements   
            int[] numbers = new int[5]; 
            
        // Populating the array, using a for loop
            for(int i = 0; i < numbers.length; i++) {
                numbers[i] = (i * i * i);
                System.out.println(i + " element of the array is: " + numbers[i]);
            }
            
        // Display some elements on a if-esle statment
            for(int j = 0; j < numbers.length; j++) {
                if(numbers[j] < 10)
                    System.out.println("Value of index " + j + " is less than 10.");
                else
                    System.out.println("Value of index " + j + " is greater than 10.");
            }
        }

  6. #6
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    9

    Default

    Milet, the best place to start is at the Sun Java Tutorials!

    The Java™ Tutorials

    This site coveres everything you need to know in a clear and easy to understand manner! You'll learn alot there :D
    Did this post help you? Please me! :cool:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •