“Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible” (Wikipedia)
The majority of our robot code is made in Java, and at least basic familiarity with the language is necessary to contribute to robot code. APCSA, FTC, or the following resources are all great starting points to learn java, and you should be able to pick up a lot of it by working with the robot code.
These resources are good if you are totally new to programming, and cover Java from the very basics. However, we'd like you to keep in mind that
This isn’t a Java class. What we want is recognition so you can get into the code and have some idea of what’s going on. Don’t spend enough time on the book to be comfortable, just familiar.
Don't feel like you need to be "fluent" before moving on to Stage 2 articles - a "working proficiency" is fine.
-
Codecademy - online course
-
Head First Java - book
Don't read the entire book! Here are the chapters that contain the knowledge you really need to know:
- 1-4
- 5-6. You don't need to go through the motions of building the dotcom game, but make sure you know how it works
- 7-8
- 10 (ignore the date/calendar stuff at the end)
- 11 (skip the music player project, but read the parts about handling exceptions)
This book is best for conceptual knowledge, but you should be doing practice problems while you are reading through it. You don't need to finish the book before starting on practice problems. The codecademy (+ eventually on the robot) exercises are how you learn to actually apply these skills.
If you already have programming experience, but no Java experience, this might be useful:
Lambdas and functional programming are important concepts to WPILib's Command Based system, which you will learn about in the next few articles. Feel free to read this article now, or wait until you get some of the context about what Command-Based programming is and how we use it.
The best way to learn to program is to do it and look up things as you need them. The exercises below are a starting point (and required) to learn Java, but you are encouraged to continue to write programs in it to improve your understanding of the language.
- Write a program to compute the first 64 fibbonaci numbers and print them to the standard output. This program must complete in under 1 second. Feel free to use this website to write and run the code, or run it on your own machine. Show a lead or mentor once you're done.
- Complete the LED Project!