This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I learn Java?  RSS feed

 
Tim Hoang
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I have ask questions on java a couple times on this site. I am learning about computer science starting off with Java through Textbooks and AP books on my own. I am wondering how should I perform this. How do classrooms work, is it by studying and memorization or is it more hands-on using programs? How should I study for Computer Science efficiently for AP tests and get ready for job offers. Any recommended sites other than this site?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66184
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will learn little to nothing via memorization -- the only way to learn programming, with Java or otherwise, is to write code. Lots of code. Oodles of code. Tons of code,
 
Tim Hoang
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say lots of coding, you mean execute, apply, and compile after every lesson? I don't have a teacher to tell me this. This is probably the reason why I have no ideas on how to use my knowledge of java. Ideas must be popping in your mind constantly and you could make them happen.
 
Tim Hoang
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I may ask could anyone be willing to provide small projects I could perform to strengthen my understanding of java?
What I already know should be sufficient:
Packages and classes
types and identifiers
classes and objects
control structures
inheritance and polymorphism
the standard classes (object,string,math..)
 
Mohamed Sanaulla
Bartender
Posts: 3178
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of them out here might have learnt Java on their own- Using the books, guides available and as said by Bear Bibeault- writing tons of code So learning a programming language is- Learning the paradigm its based on: OOP for Java and then learning its syntax and language features. You would have to in parallel write code, compile them and run them For programming problems you can check out- Project Euler, CodeKata, CodeChef among others.
 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try programming something that you're interested in. If you like playing cards, try programming a simple card game. If you like maths, try doing a graphing program, compute factorials, the value of pi, Newton-Raphson equation-solving etc. If you like music, investigate the midi packages.

If you read a book like Head First Java, that will give you lots of ideas with its examples. My preferred way is to read through what they did, then go and try to program the same thing myself without looking back at how they did it, unless I get really stuck.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12541
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our own CattleDrive has many assignments you can try for free. If you want them nit-picked by a staffer there is a cost, but there is no reason you couldn't read and try them on your own.

Project Euler also has a TON of programming problems. Granted, they require some complicated math, but the programs themselves can be rather simple.
 
Campbell Ritchie
Marshal
Posts: 55677
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Hoang wrote:When you say lots of coding, you mean execute, apply, and compile after every lesson? . . .
No. Compile and execute your code after every 5th line written. You want to find whether it works every few minutes. It makes finding errors much easier.
 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:Our own CattleDrive has many assignments you can try for free. If you want them nit-picked by a staffer there is a cost, but there is no reason you couldn't read and try them on your own.

Project Euler also has a TON of programming problems. Granted, they require some complicated math, but the programs themselves can be rather simple.


Good links, thanks - I might try a few of these.

I'm looking at some of the Project Euler ones but what I find slightly off-putting is knowing how much is supposed to be testing my maths and how much my coding prowess. Like some of the physics-type problems, if you had them in an exam you know there's going to be an analytic solution, but for example:
A firecracker explodes at a height of 100 m above level ground. It breaks into a large number of very small fragments, which move in every direction; all of them have the same initial velocity of 20 m/s.

We assume that the fragments move without air resistance, in a uniform gravitational field with g=9.81 m/s2.

Find the volume (in m3) of the region through which the fragments move before reaching the ground. Give your answer rounded to four decimal places.

Seems like something you could solve by geometry + calculus... or should I ditch the equations and just go for a numerical simulation?
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Luigi Plinge wrote:Seems like something you could solve by geometry + calculus... or should I ditch the equations and just go for a numerical simulation?

I'm not sure what they're expecting, as I've never really looked at Project Euler...but it might be an interesting exercise to do both. Go for a simulation, and compare it to the analytical result.
 
Stephan van Hulst
Saloon Keeper
Posts: 7797
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whatever you want! As long as you find the solution. If you suck at physics or math, you can still solve a lot of the problems by "brute forcing" your way through them.

Note that in most cases the more 'geometry + calculus' you use, the less time it takes for your program to find the solution.
 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Crikey, that was difficult, but kinda fun.

Not too difficult to get an approximate answer, but getting it to 4 decimal places (11 significant figures!) in a reasonable amount of time was more of a challenge.

Pretty sure it's not possible to do without a computer... after poring over the equations for a couple of hours I ended up with a very long and ugly partial differential equation that looks unsolveable (although it's dimensionally correct).

If anyone wants to have a go and discuss solutions, let me know. Maybe we should have a Project Euler thread / forum here on JavaRanch.
 
Clarence Gillespie
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With respect to classrooms. A very inspirational professor at Stanford is Mehran Sahami. 28 videos for free that should give you a good idea. You can also get all of the documentation, projects discussed from the Stanford website as well with a little research on your part.

http://www.youtube.com/view_play_list?p=84A56BC7F4A1F852

Hope it helps!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!