| Tonyri's Learning Java Development Log | |
|
|
Author | Message |
---|
tonyri Newbie
Posts : 126 Join date : 2011-09-04 Age : 28 Location : Wisconsin, USA
| Subject: Tonyri's Learning Java Development Log Sat Dec 17, 2011 10:15 pm | |
| I already have a thread about this, but I feel it would be nice to post my learning progress on the forums here. It would also keep me motivated not to quit. So far, after a few hours of learning basics and downloading tutorials, I have managed to make this code: - Code:
-
public class Variables { public static void main(String[] args) { int test = 8; System.out.println(test); } } I don't know really what most of the terms mean, but it worked, so that's really what matters. I know that - Code:
-
int means that the I named "test" is a number without decimals, and the - Code:
-
System.out.println(test); tells the computer to write out 8. I know that ; ends a line of code. My head already hurts from the odd terminology. | |
|
| |
fr0stbyte124 Super Developrator
Posts : 1835 Join date : 2011-10-13
| Subject: Re: Tonyri's Learning Java Development Log Sun Dec 18, 2011 2:41 am | |
| Yep that looks good. FYI int stands for integer. Variables with decimals are called floating-point and are defined with "float" and "double". Double has much greater precision, using 32 bits vs float which uses only 16 bits. Also System.out.println() is a nice method because it figures out what you are trying to print and will parse it correctly without you having to do anything special. | |
|
| |
tonyri Newbie
Posts : 126 Join date : 2011-09-04 Age : 28 Location : Wisconsin, USA
| Subject: Re: Tonyri's Learning Java Development Log Sun Dec 18, 2011 7:15 pm | |
| I just learned how to make loops. Here is my code: - Code:
-
public class test { public static void main(String[] args) { int x = 5; while(x<20) { System.out.println(x); x=x+1; } } } I set it to start at 5 and keep going up by one until it got to 20. | |
|
| |
GroundBurg_Coder13 Newbie
Posts : 59 Join date : 2011-08-31
| Subject: Re: Tonyri's Learning Java Development Log Sun Dec 18, 2011 11:47 pm | |
| yup, also for the x = x +1; you can use x++ which adds 1 to x every time it loops ( or x += 1, which is the same thing), and for the while statement, there is also the for() statement which is also a loop, if you want to look it up. | |
|
| |
ectrimble20 DEV
Posts : 441 Join date : 2011-11-07
| Subject: Re: Tonyri's Learning Java Development Log Mon Dec 19, 2011 12:54 am | |
| just to add onto what GroundBurg said, a fancy thing to remember about ++ increments is that they will be done where you put them in the code, by this I mean they can be a pre or a post counter.
For instance:
int x = 2
If you do this:
x++ System.out.println(x)
You'll get 3, but if you do this
System.out.println(x) x++
You'll get 2.
The reason I mention this is that it can be crucial to other aspects of your code when the number changes.
Anyway, just a pointer from someone who's fought that battle before.
As for the for statement, its generally written as so:
for(int x = 0; x < 10; x++)
this will loop until x is greater than 10. Same basic principal as the while loop, but it handles the increment for you.
Keep at it! | |
|
| |
Apokalypse Newbie
Posts : 33 Join date : 2011-12-21
| Subject: Re: Tonyri's Learning Java Development Log Wed Dec 21, 2011 1:20 am | |
| where exactly are you learning java ive been looking forever for a decent tutorial. i started learning Darkbasic but im not very good at programming atm | |
|
| |
ectrimble20 DEV
Posts : 441 Join date : 2011-11-07
| Subject: Re: Tonyri's Learning Java Development Log Wed Dec 21, 2011 1:23 am | |
| Oracle's Java TutorialsI use these for finding information about what I'm doing and for really detailed explanations of all the magical BS that takes place with Java. | |
|
| |
Apokalypse Newbie
Posts : 33 Join date : 2011-12-21
| Subject: Re: Tonyri's Learning Java Development Log Wed Dec 21, 2011 1:27 am | |
| | |
|
| |
fr0stbyte124 Super Developrator
Posts : 1835 Join date : 2011-10-13
| Subject: Re: Tonyri's Learning Java Development Log Wed Dec 21, 2011 1:42 am | |
| I found this thread on the minecraft forums to be invaluable. It's geared toward those who already have a programming background, but it's got great info on Java's inner workings and how to leverage the best performance out of it. So if you're just starting out, don't worry about it. I just figured I'd share while we were on the topic. | |
|
| |
ACH0225 General
Posts : 2346 Join date : 2012-01-01 Location : I might be somewhere, I might not.
| Subject: Re: Tonyri's Learning Java Development Log Wed Jan 04, 2012 1:31 am | |
| I have been considering learning some sort of coding myself, bit then I realized, coding is like math(correct me if I'm wrong), and I very much dislike math, it confuses me. I understand math is a necessary thing, but I avoid it when possible. I can understand a complex book, how a car engine works, but math stumps me. And....... I'm out of fuel for my rant | |
|
| |
fr0stbyte124 Super Developrator
Posts : 1835 Join date : 2011-10-13
| Subject: Re: Tonyri's Learning Java Development Log Wed Jan 04, 2012 1:44 am | |
| Depending on what you are doing there could be a lot of very difficult math or very little math of any sort. Programming is mostly logic by itself, and you get better at thinking in those terms the more you do it. There's plenty you can do with programming even if you are bad at math, though I have no idea what you are interested so I couldn't advise any more specifically. | |
|
| |
ACH0225 General
Posts : 2346 Join date : 2012-01-01 Location : I might be somewhere, I might not.
| Subject: Re: Tonyri's Learning Java Development Log Wed Jan 04, 2012 2:07 am | |
| - fr0stbyte124 wrote:
- Depending on what you are doing there could be a lot of very difficult math or very little math of any sort. Programming is mostly logic by itself, and you get better at thinking in those terms the more you do it. There's plenty you can do with programming even if you are bad at math, though I have no idea what you are interested so I couldn't advise any more specifically.
I am pretty good at logic puzzles, but I don't know what I would do with any programming skills… Nothing, probably | |
|
| |
ectrimble20 DEV
Posts : 441 Join date : 2011-11-07
| Subject: Re: Tonyri's Learning Java Development Log Wed Jan 04, 2012 11:49 am | |
| Well like I tell anyone interested in learning Java, look up those tutorials that I posted. Check out that post Frost linked to. You can't learn something if you let it beat you before you've even started.
I can tell you from experience that learning programming languages can be rough.
I learned HTML when I was 13, Perl when I was 15, PHP when I was 16, threw some SQL in there around 17. By the time I was 20 I had dabbled in everything from QBasic to C++ back to HTML, CSS, and all kinds of stuff.
And also remember this, and this is very important: You don't need to know everything about a language, but you do need to know how to find out how to do what you're trying to do.
Basically what that means is that Google is your best friend. I don't know everything about all the languages I work in, but I sure as hell know how to find how to do what I'm trying to do.
Anyway, I kinda went off on a tangent there, didn't mean to babble on, just trying to give you some perspective as to what goes into learning how to program.
| |
|
| |
Sponsored content
| Subject: Re: Tonyri's Learning Java Development Log | |
| |
|
| |
| Tonyri's Learning Java Development Log | |
|