Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By Alerhau

Thread: For People That's New to Java!

  1. #1
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    3

    Default For People That's New to Java!

    Hi everyone! I have some stuff for new people in Java! If you need some tutorials, check out mine and I promise that you'll learn java on about 4 months if you're active! :) Enjoy! My Channel

    Why do I do this? Because I love to help people! So this is just for helping new people out! :)

    Alerhau
    hossein71 likes this.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

  3. #3
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    I hope you don't mind a little nitpick...

    Java Code:
    int i = 20;
    System.out.println(i++); // displays "20"
    At 3:48 we're told "that's because first of all it prints it out on the screen. After that it makes it one higher."

    In fact the expression "i++" does something and it has a value. What it does is make the value of i one higher (it increments the value), and the value the expression "i++" has is the value of i before the increment happened. So the order of things is not (1) print i (2) make i one higher. Rather it is (1) make i one higher (2) print the value of i++, ie print 20.

    In more complicated examples forgetting the distinction between what the expression does when it is evaluated and the value it has as a result of that evaluation can lead to trouble.

    Details (because it's always good to know *more* than you want to explain...) in the Java Language Specification: 15.14.12 (Postfix Increment Operator). Sorry about the weird link, the links reported by google to Oracle's site are mostly stale. Well done, Oracle!

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I believe this code snippet works similar to that of postfix increment. Correct me if I'm wrong.
    Java Code:
    public class Ex{
      private int x;
      public int postfixInc(){
        int newInt = x;
        x += 1;
        return newInt;
      }
    }

  5. #5
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    3

    Default

    Quote Originally Posted by pbrockway2 View Post
    I hope you don't mind a little nitpick...

    Java Code:
    int i = 20;
    System.out.println(i++); // displays "20"
    At 3:48 we're told "that's because first of all it prints it out on the screen. After that it makes it one higher."

    In fact the expression "i++" does something and it has a value. What it does is make the value of i one higher (it increments the value), and the value the expression "i++" has is the value of i before the increment happened. So the order of things is not (1) print i (2) make i one higher. Rather it is (1) make i one higher (2) print the value of i++, ie print 20.

    In more complicated examples forgetting the distinction between what the expression does when it is evaluated and the value it has as a result of that evaluation can lead to trouble.

    Details (because it's always good to know *more* than you want to explain...) in the Java Language Specification: 15.14.12 (Postfix Increment Operator). Sorry about the weird link, the links reported by google to Oracle's site are mostly stale. Well done, Oracle!
    I actually tried to note this. I will put up some comments if it was difficult to understand! :)

  6. #6
    popeyito18's Avatar
    popeyito18 is offline Member
    Join Date
    Jun 2011
    Location
    USA
    Posts
    17
    Rep Power
    0

    Default

    I'm new to Java, everything helps right now!
    Thanks for taking the time to do some videos.

  7. #7
    aviolently is offline Member
    Join Date
    Jun 2011
    Posts
    23
    Rep Power
    0

    Default

    welcome to java....i just joined moment ago cause i forgot my old account ^^! welcome!

Similar Threads

  1. Most BIZARRE problem ever ( Need Advance People )
    By trupsterful in forum Advanced Java
    Replies: 11
    Last Post: 06-12-2011, 04:17 AM
  2. How do other people run my program
    By silverglade in forum New To Java
    Replies: 4
    Last Post: 04-25-2011, 11:38 AM
  3. For the people who love Calculus
    By tim in forum Forum Lobby
    Replies: 9
    Last Post: 12-01-2009, 12:53 PM
  4. People class and Printlns
    By natep67 in forum New To Java
    Replies: 3
    Last Post: 05-02-2009, 04:29 AM
  5. Wats up, Java people
    By littlebrat in forum Introductions
    Replies: 0
    Last Post: 02-12-2009, 05:48 PM

Tags for this Thread

Posting Permissions

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