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

Thread: Some questions related to learning Java

  1. #1
    Member
    Join Date
    Jun 2011
    Posts
    94
    My Mood
    Amazed
    Thanks
    22
    Thanked 1 Time in 1 Post

    Default Some questions related to learning Java

    Hi,
    I am a very new learner here. I hope you people can share your ideas with me.
    At the moment, I know a little about Java. Variables, arrays, operators, statements etc. I am investigating about classes at the moment.

    Now questions:
    1-Can I not make practices for now? I have very limited knowledge. To tell the truth, I don't have the knowledge to develop a console calculator (My book and videos did not mention how to get data from the user). But you need to practice in order not to forget what you learnt. So, what to do at this point? I don't feel confident to proceed. I mean I feel like I am forgetting what I learnt because of lacking practice.

    2- When should I start to learn GUI programming?

    3- What do you suggest for proceeding in Java?

    Thank you...


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Some questions related to learning Java

    The answer to all your questions is READ.

    Read as many books as you can buy, borrow from the library, download off the net.
    Read as many tutorials on the net as you can find.

    Asking for other peoples opinions does not mean that they will suggest something suitable to you. Only you can decide what books you like, what career path to follow.

  3. #3
    Member
    Join Date
    Jun 2011
    Posts
    94
    My Mood
    Amazed
    Thanks
    22
    Thanked 1 Time in 1 Post

    Default Re: Some questions related to learning Java

    Thank you for your answer. So, this is the answer for question 3 And answer to the second partly.

    But how about the first one? At the moment, my codes like this: "Define an int variable. Put it into a loop or something. Then print something else.
    At this point, I just can't find proper 'exercise' to apply what I learnt so far.

    Is it me not able to find, or these are not needed at this point?

  4. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Some questions related to learning Java

    One website that is often recommended when people ask this question is Project Euler. Otherwise type "Java puzzles" or "Java exercises" or something similar into Google.

  5. #5
    Member
    Join Date
    Jun 2011
    Posts
    182
    My Mood
    Where
    Thanks
    15
    Thanked 8 Times in 8 Posts

    Default Re: Some questions related to learning Java

    First off let me help you a bit with getting user input.
    [CODE]
    import java.io.*;
    public class CalcInput {
      public String getUserInput(String prompt) {
        String inputLine = null;
        System.out.print(prompt + " ");
        try {
          BufferedReader is = new BufferedReader(
          new InputStreamReader(System.in));
          inputLine = is.readLine();
          if(inputLine.length() == 0) return null;
        } catch(IOException e) {
          System.out.println("IOException: " + e);
        }
        return inputLine;
      }
    }
    [/CODE]

    Just copy and paste this into a class (call it whatever you like) and call the getUserInput method whenever you need user input. Don't try to understand the code yet. Just use it. I am somewhat of a java noob too. I don't even fully understand that code, but it can be applied to most fundamental situations regarding user input.

    When you need it, do this: (let's assume you named the class for it "UserInput")
    [CODE]
    // Create a new object (with reference variable "user") for the input reader class.
    UserInput user = new UserInput();
    // Call the UserInput object's getUserInput method.
    String userInput = user.getUserInput("Your message here");
    // The user input has been assigned to the String "userInput"
    // The rest of your code follows.  Do what you need with this user input.
    // Example:
    if(userInput.equals("Dog")) {
      System.out.println("Here is your new dog.");
    // Or make the userInput an integer (say they were supposed to enter a number)
    int input = Integer.parseInt(userInput);
    [/CODE]

    Just use this if you want to get user input at the command line.

    Now for your other questions.

    Hold off on learning GUIs. I haven't even learned it yet! It's something that needs to come after you have mastered the skills of dealing with variables, understanding objects, classes, methods (how to call them), inheritance, and other things.

    I HIGHLY recommend getting the book Head First Java if you haven't already.

    It is a well-paced, well-explained book that will REALLY help you as a newcomer to Java.

    Let me know if you have anymore questions.

  6. #6
    Member
    Join Date
    Jun 2011
    Posts
    94
    My Mood
    Amazed
    Thanks
    22
    Thanked 1 Time in 1 Post

    Default Re: Some questions related to learning Java

    Thank you both. I really appreciate your replies.

    bgroenks96,

    I think I can understand some parts of the input code. And as I learn more later, I will understand it better and maybe code my own. Thanks for that.

    I cannot find the book, because I am not a native speaker and I don't live where it is sold
    Today, I took a look at the Oracle's Java tutorials. And I think I can combine it with my present references and maybe find one or two more. I should take notes and I feel like it will be just okay. The rest is up to my ability to think algorithms and understand. And of course, to my creativity.

    About the GUI, I decided to hold off for a while. After I master the most things about classes, methods and inheritance and packages etc., then I would take little steps into it. Coming from Basic (Not mastered everything of it - It was a 'very free time' hobby), that class thing is a little tough for me. I thought if I would ever give up, the reason would be classes. But Oracle tutorials cover the basics, and as I mentioned before, the rest is up to me.

    To sum up, thank you. Both of you.

Similar Threads

  1. Learning Java
    By jgc1 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: May 6th, 2011, 06:17 PM
  2. java servlet related
    By vidi in forum Member Introductions
    Replies: 0
    Last Post: April 16th, 2011, 10:26 PM
  3. New to Java....still learning...Help Required
    By muraduk in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 12th, 2010, 03:15 PM
  4. Hello. Just Learning Java For Fun..
    By derekeverett in forum Member Introductions
    Replies: 1
    Last Post: March 18th, 2010, 04:24 PM
  5. Java Learning Resource for Beginners
    By Freaky Chris in forum The Cafe
    Replies: 1
    Last Post: April 29th, 2009, 04:57 AM