Results 1 to 10 of 10
  1. #1
    Unorthadox is offline Member
    Join Date
    Aug 2012
    Posts
    2
    Rep Power
    0

    Default New to Java, Few Questions

    Hi, im new to java and am currently studying it at university, i was wondering if anyone could answer and explain these questions for me please? :)

    a) There are three different types of loop. Explain the difference between them
    b) Write an appropriate loop to
    i. Read in 10 names from a file
    ii. Read a number of names from a file until the word STOP is read in.
    a) Explain what an array is and describe how it can be created and used.
    b) Show the pseudo code and the code to read 10 numbers into an array and find the highest. Explain, using examples of Java, how the following could be carried out:
    a) Ask a user to input their name and address details and display the input on the screen.
    b) Read a list of names from a file, and display them on the screen.
    c) Write a list of books to a file.
    A) Using examples of code explain the uses of following
    i. A JTextField
    ii. A JPanel
    iii. A JFrame
    iv. A JLabel
    B) Show how JButtons can be used to:
    i. Close a form
    ii. To open a new form
    A) Using examples describe classes and objects and explain the relationship between them.
    B) Explain how information hiding is implemented in Object Oriented programming and why it is used.

    Thanks in advance.

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,925
    Rep Power
    19

    Default Re: New to Java, Few Questions

    You want us to answer your homework?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Unorthadox is offline Member
    Join Date
    Aug 2012
    Posts
    2
    Rep Power
    0

    Default Re: New to Java, Few Questions

    Its not homework, its something i dont understand and need help answering.
    But nevermind

  4. #4
    lannie1980 is offline Member
    Join Date
    Mar 2012
    Posts
    88
    Rep Power
    0

    Default Re: New to Java, Few Questions

    Just do a google mate or read your uni texts - won't take you long to answer these questions.

  5. #5
    Tim Rogers is offline Member
    Join Date
    Aug 2012
    Posts
    4
    Rep Power
    0

    Default Re: New to Java, Few Questions

    Loops-
    a) There are three types of loops-
    ---For- It is nearly same to while loop. It just has the difference of syntax--
    for(int i = 0; i < 6; i++){
    System.out.println(i);
    }
    ---While- It is nearly same to the for loop. It just has the difference of syntax--
    while(i < 6) {
    System.out.println(i);
    }
    Note: I recommend you use the For loop as it is more organised way
    ---Do/While- In this loop the code in the do{}block is executed at least whether the while condition is true or false
    do{
    System.out.println();
    }while(i<6) {
    System.out.println(i);
    }

  6. #6
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: New to Java, Few Questions


  7. #7
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: New to Java, Few Questions

    All of these questions can be answered by you if you learn Java.
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: New to Java, Few Questions

    Please go through the Forum Rules -- particularly the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    lannie1980 is offline Member
    Join Date
    Mar 2012
    Posts
    88
    Rep Power
    0

    Default Re: New to Java, Few Questions

    Quote Originally Posted by Tim Rogers View Post
    Loops-
    a) There are three types of loops-
    ---For- It is nearly same to while loop. It just has the difference of syntax--
    for(int i = 0; i < 6; i++){
    System.out.println(i);
    }
    ---While- It is nearly same to the for loop. It just has the difference of syntax--
    while(i < 6) {
    System.out.println(i);
    }
    Note: I recommend you use the For loop as it is more organised way
    ---Do/While- In this loop the code in the do{}block is executed at least whether the while condition is true or false
    do{
    System.out.println();
    }while(i<6) {
    System.out.println(i);
    }
    Also does a For each loop count as well? Does this mean there are 4 types of loop available?

    Java Code:
    For (String aString : Strings)
    {
    System.out.println("Hello");
    }

  10. #10
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: New to Java, Few Questions

    Quote Originally Posted by lannie1980 View Post
    Also does a For each loop count as well? Does this mean there are 4 types of loop available?

    Java Code:
    For (String aString : Strings)
    {
    System.out.println("Hello");
    }
    A for-each loop does not have an upper-case "F"
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

Similar Threads

  1. Replies: 11
    Last Post: 04-29-2012, 05:50 AM
  2. Questions about java JVM
    By davetheant in forum New To Java
    Replies: 12
    Last Post: 02-15-2011, 12:31 AM
  3. Some Java questions
    By vegetable69 in forum New To Java
    Replies: 1
    Last Post: 11-29-2010, 12:47 PM
  4. JAVA questions
    By melody in forum New To Java
    Replies: 0
    Last Post: 10-28-2009, 11:07 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
  •