Results 1 to 7 of 7
Thread: For People That's New to Java!
- 06-11-2011, 05:17 PM #1
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
-
Moderation: Moved from "New to Java" forum.
- 06-12-2011, 03:37 AM #3
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,546
- Rep Power
- 11
I hope you don't mind a little nitpick...
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."Java Code:int i = 20; System.out.println(i++); // displays "20"
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!
- 06-12-2011, 05:56 AM #4
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
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; } }
- 06-12-2011, 08:44 AM #5
- 06-25-2011, 05:37 PM #6
I'm new to Java, everything helps right now!
Thanks for taking the time to do some videos.
- 06-25-2011, 09:26 PM #7
Member
- Join Date
- Jun 2011
- Posts
- 23
- Rep Power
- 0
Similar Threads
-
Most BIZARRE problem ever ( Need Advance People )
By trupsterful in forum Advanced JavaReplies: 11Last Post: 06-12-2011, 04:17 AM -
How do other people run my program
By silverglade in forum New To JavaReplies: 4Last Post: 04-25-2011, 11:38 AM -
For the people who love Calculus
By tim in forum Forum LobbyReplies: 9Last Post: 12-01-2009, 12:53 PM -
People class and Printlns
By natep67 in forum New To JavaReplies: 3Last Post: 05-02-2009, 04:29 AM -
Wats up, Java people
By littlebrat in forum IntroductionsReplies: 0Last Post: 02-12-2009, 05:48 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks